Smallest number after deletions

Write codeMedium16 min

Your task

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'.

Examples

smallest_after_removals(num: str, k: int) -> str
Example 1
Inputsmallest_after_removals("1432219", 3)
Output"1219"