My Easy Java Solution | Beginner Friendly |O(n)
\n//minimum number = lexicographically minimum string for same length\n//TC : O(n)\n//SC : O(n), when k = 0\nclass Solution {\n    public String removeKdigits(S
```\n//minimum number = lexicographically minimum string for same length\n//TC : O(n)\n//SC : O(n), when k = 0\nclass Solution {\n    public String removeKdigits(String num, int k) {\n        Deque<Character> dq = new ArrayDeque<>();\n        \n        for(int i = 0; i < num.length(); ++i){ //case -1\n            char ch = num.charAt(i);\n            \n            while(dq.size() > 0 && k > 0 && dq.getLast() > ch){\n                dq.removeLast();\n                k--;\n            }\n            \n            dq.addLast(ch);\n        }\n        \n        while(dq.size() > 0 && k > 0){ //remove last k characters, after processing the whole num string\n            dq.removeLast();           //while k not become 0 and dq.size > 0 (case - 2) \n            k--;\n        } \n        \n        while(dq.size() > 0 && dq.getFirst() == \'0\'){ //remove leading zeroes\n            dq.removeFirst();           \n        } \n        \n        if(dq.size() == 0) return "0";\n        \n        StringBuilder res = new StringBuilder();\n        while(dq.size() > 0){\n            res.append(dq.removeFirst());\n        }\n        \n        return res.toString();\n    }\n}\n```\n**If you find this solution useful, then please UPVOTE it, so that it can reach to the maximum person. Thank You!**
['Java']