simple c++ using stack
\nstring removeKdigits(string num, int k) {\n\n\tstring res = "";\n\n\tfor (int i = 0; i < num.length(); ++i) {\n\t\twhile (!res.empty() && res.back() > num[i] 
```\nstring removeKdigits(string num, int k) {\n\n\tstring res = "";\n\n\tfor (int i = 0; i < num.length(); ++i) {\n\t\twhile (!res.empty() && res.back() > num[i] && k > 0) {\n\t\t\t--k;\n\t\t\tres.pop_back();\n\t\t}\n\t\tif (!res.empty() || num[i] != \'0\') res.push_back(num[i]);\n\t}\n\tfor (; !res.empty() && (k > 0); --k) res.pop_back();\n\n\treturn res == "" ? "0" : res;\n}\n```
[]