402. Remove K Digits
Last updated
Was this helpful?
Last updated
Was this helpful?
Given string num representing a non-negative integer num
, and an integer k
, return the smallest possible integer after removing k
digits from num
.
1 <= k <= num.length <= 105
num
consists of only digits.
num
does not have any leading zeros except for the zero itself.
GeeksforGeeks
ProgramCreek
Input: num = "1432219", k = 3
Output: "1219"
Explanation: Remove the three digits 4, 3, and 2 to form the new number 1219 which is the smallest.