Practice Remove K Digits
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num.
Source: Remove K Digits on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
num = "1432219", k = 3
Output
"1219"
# Example 2
Input
num = "10200", k = 1
Output
"200"
# Example 3
Input
num = "10", k = 2
Output
"0"
Constraints
1 <= k <= num.length <= 10^5
num consists of only digits.
num does not have any leading zeros except for the zero itself.
Related LeetCode Problems
Practice more problems similar to Remove K Digits.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.