|| CRYSTAL CLEAR AND CLEAN SOLUTION AND APPROACH ||
Please Upvote if you like the approach \n\n\n\n# Code\n\nclass Solution {\npublic:\n    string removeKdigits(string num, int k) {\n        if(num.length()<=k){\
**Please Upvote if you like the approach **\n![meme.gif](https://assets.leetcode.com/users/images/3b63b1c6-775e-4b71-9a66-04c40e100d4f_1687955562.4185.gif)\n\n\n# Code\n```\nclass Solution {\npublic:\n    string removeKdigits(string num, int k) {\n        if(num.length()<=k){\n            return "0";\n        }\n        if(k==0){\n            return num;\n        }\n        string res="";\n        stack<char>st;\n        st.push(num[0]);\n        for(int i=1;i<num.length();i++){\n            while(k>0 and !st.empty() and num[i]<st.top()){\n                k--;\n                st.pop();\n            }\n            st.push(num[i]);\n            if(st.size()==1 and num[i]==\'0\'){\n                st.pop();\n            }\n        }\n        while(k and !st.empty()){\n            k--;\n            st.pop();\n        }\n        while(!st.empty()){\n            res.push_back(st.top());\n            st.pop();\n        }\n        reverse(res.begin(),res.end());\n        if(res.length()==0){\n            return "0";\n        }\n        return res;\n    }\n};\n```
['C++']