You are given a numeric string and an integer k. Your task is to delete exactly k digits from the string so that the resulting number is the smallest possible.
The digits must remain in their original order, and the final result must not contain unnecessary leading zeroes.
If removing all digits results in an empty value, return "0".
Input: num = "7650281", k = 3
Output: "0281"
Explanation:
Removing digits '7', '6', and '5' makes the smallest result. After trimming leading zero, final answer is "281".
Input: num = "200111", k = 2
Output: "0111"
Explanation:
Remove the '2' and one '1', giving the smallest possible remaining number. After removing leading zero → "111".
Input: num = "9", k = 1
Output: "0"
Explanation:
Removing the only digit leaves nothing, so return "0".
Accepted:
Submission: