Back to course home
0% completed
Solution: Remove K Digits
Problem Statement
Given a nonnegative integer represented as a string num
and an integer k
, delete k
digits from num
to obtain the smallest possible integer. Return this minimum possible integer as a string.
Examples

 Input:
num = "1432219", k = 3
 Output:
"1219"
 Explanation: The digits removed are 4, 3, and 2 forming the new number 1219 which is the smallest.
 Input:

 Input:
num = "10200", k = 1
 Output:
"200"
 Explanation: Removing the leading 1 forms the smallest number 200.
 Input:

 Input:
num = "1901042", k = 4
 Input:
.....
.....
.....
Like the course? Get enrolled and start learning!