[Python] - Simple solution with stack
\n    def removeKdigits(self, num: str, k: int) -> str:\n        \n        stack = []\n        for each in num:   \n\t\t\t# Pop element from stack if the curren
\n    def removeKdigits(self, num: str, k: int) -> str:\n        \n        stack = []\n        for each in num:   \n\t\t\t# Pop element from stack if the current element is smaller than last added element in stack\n            while k and stack and stack[-1]>each:\n                stack.pop()\n                k -= 1\n            stack.append(each)\n        \n\t\t# If still k elements left to remove, then remove them from the stack.\n        while k>0:\n            stack.pop()\n            k -= 1\n        #Remove leading zeros\n        output = "".join(stack).lstrip("0")\n     \n        return (output if output else "0")\n
['Stack', 'Python', 'Python3']