Beginner friendly [Java/JavaScript/Python] Solution
\npython []\nclass Solution(object):\n    def removeKdigits(self, num, k):\n        stack = []\n        for c in num:\n            while stack and k>0 and stack
\n```python []\nclass Solution(object):\n    def removeKdigits(self, num, k):\n        stack = []\n        for c in num:\n            while stack and k>0 and stack[-1] > c:\n                stack.pop()\n                k -= 1\n            stack.append(c)\n        while stack and k>0:\n            stack.pop()\n            k -= 1\n        if not stack:\n            return "0"\n        return str(int("".join(stack)))\n```\n\n```javascript []\nvar removeKdigits = function(num, k) {\n   var stack = []\n    for(let c of num){\n        while(stack.length && k>0 && stack[stack.length-1] > c){\n            stack.pop()\n            k--\n        }\n        stack.push(c)\n    }\n    while(stack.length && k>0){\n        stack.pop()\n        k--\n    } \n    while(stack.length && stack[0] == \'0\'){\n        stack.shift()\n    }\n    return stack.join(\'\') || "0"    \n};\n```\n\n```java []\nclass Solution {\n    public String removeKdigits(String num, int k) {\n        Stack<Character> stack = new Stack<>();\n        for(char c : num.toCharArray()){\n            while(!stack.isEmpty() && k > 0 && stack.peek() > c) {\n                stack.pop();\n                k--;\n            }   \n            stack.push(c);   \n        }\n        while(!stack.isEmpty() && k > 0){\n            stack.pop();\n            k--;\n        }\n        StringBuilder sb = new StringBuilder();\n        while(!stack.isEmpty()){\n            sb.append(stack.pop());\n        }\n        sb.reverse();\n        while(sb.length() > 1 && sb.charAt(0) == \'0\'){\n            sb.deleteCharAt(0);\n        }\n        return sb.length() > 0 ? sb.toString() : "0";\n    }\n}\n```
['Python', 'Java', 'JavaScript']