C++ Solution with Runtime: 0 ms, faster than 100.00%
\nclass Solution {\npublic:\n    string removeKdigits(string num, int k) {\n        // answer will be the longest possible increasing string\n        stack<char
```\nclass Solution {\npublic:\n    string removeKdigits(string num, int k) {\n        // answer will be the longest possible increasing string\n        stack<char> stk;\n        for (auto it : num)\n        {\n            while (!stk.empty() && k > 0 && stk.top() > it)\n            {\n                stk.pop();\n                k--;\n            }\n            stk.push(it);\n        }\n        // if k is still left\n        while (k--)\n            stk.pop();\n        \n        string result;\n        int size = stk.size();\n        for (int i = 0; i<size; i++)\n        {\n            result.push_back(stk.top());\n            stk.pop();\n        }\n        int i = 0, j = result.size() - 1;\n        while (i < j)\n            swap(result[i++], result[j--]);\n        // handling edge cases\n        k = 0;\n        while (result[k] == \'0\')\n            k++;\n        result.erase(begin(result), begin(result) + k);\n        if (result.size() == 0)\n            result = "0";\n        return result;\n    }\n};\n```\n\nApproach: The answer will the longest possible weakly increasing sequence. Try to make a weakly increasing monotone stack while k > 0 if k becomes 0 but string is still left then the partial order + the remaining string is the answer. Weakly increasing because let "112" and k = 1, then answer will be "11" and not "12" since "11" < "12".
['Stack', 'C']