Use a monotonic stack to remove k digits and produce the smallest possible number.
Constraints
Example
>>> remove_k_digits("1432219", 3)
'1219'
>>> remove_k_digits("10200", 1)
'200'
>>> remove_k_digits("10", 2)
'0'
>>> remove_k_digits("112", 1)
'11'
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints