Smallest number after deletions
Given a string of digits num (no sign, possibly with leading zeros after deletions) and an integer k, delete exactly k digits so that the remaining digits, kept in order, read as the smallest possible number. Return that number as a string without unnecessary leading zeros; return '0' if nothing remains or only zeros remain. Example: num '1432219' with k = 3 gives '1219'.
Implement
smallest_after_removals(num: str, k: int) → strExamples
in
["1432219",3]out"1219"What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 16 min
solution.py
InputExpectedGot
["1432219",3]"1219"not run yetsample