Python Solution || Monotonic Stack || O(n) time
\n\n\nclass Solution:\n    def removeKdigits(self, num: str, k: int) -> str:\n        st = []\n        for i in num:\n            while k and len(st) > 0 and st
![image](https://assets.leetcode.com/users/images/5a54d695-dec1-49bb-b231-b882ab929751_1645173565.3199916.png)\n\n```\nclass Solution:\n    def removeKdigits(self, num: str, k: int) -> str:\n        st = []\n        for i in num:\n            while k and len(st) > 0 and st[-1] > i:\n                k -= 1\n                st.pop()\n            st.append(i)\n        while k:\n            k -= 1\n            st.pop()\n        st = "".join(st).lstrip("0")\n        return st if st else "0"\n```\n\n**Please upvote if you find the solution helpful and interesting!!!\nThank you.**
['Greedy', 'Monotonic Stack', 'Python3']