Back to course home
0% completed
Remove K Digits (hard)
Problem Statement
Given a non-negative 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!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible