num is a non-negative whole number written as a string of digits, and k is how many of those digits you must delete. The digits you keep stay in their original order and close up into a new number. Return the smallest number you can end up with, as a string.
Write the result without leading zeros. If every digit is deleted, or only zeros remain, return "0".
Three digits stay. No three-digit pick can start with 1, since only 7 comes after it, so the best start is 2. After that, 1 and 7 give 217, which beats picks such as 281 or 287.
Deleting the 3 leaves 0059, which is written 59.
Both digits go, and nothing left counts as 0.
Constraints
1 <= k <= num.length <= 10⁵num holds only the digits 0 to 9.num has no leading zeros, except when it is "0" itself.Two numbers of the same length are compared from the left, so one smaller digit near the front beats any change further right. Ask, for each digit, whether deleting it lets a smaller digit move into its place.