Inspired by https://discuss.leetcode.com/topic/59380/short-python-one-o-n-and-one-regex

We only do k-- at most k times so it's O(n) not O(n*k)

```
public String removeKdigits(String num, int k) {
int len = num.length(), hi = 0, left = len - k;
if (len == k) return "0";
char[] res = new char[len];
for (int i = 0; i < len; i++) {
while (len - i + hi > left && k > 0 && hi > 0 && res[hi - 1] > num.charAt(i)) {
hi--;
k--;
}
if (hi < left) res[hi++] = num.charAt(i);
}
int lo = 0;
while (lo < hi && res[lo] == '0') lo++;
return lo == hi ? "0" : new String(res, lo, hi - lo);
}
```