Tap here to switch tabs
Problem
Ask
Submissions

Problem: Remove K Digits

med
30 min
Explore how to solve digit removal problems by applying greedy algorithms. Learn to efficiently remove exactly k digits from a numeric string to form the smallest number possible. Understand constraints and implement your solution with guided practice.

Statement

Given a string, num, that represents a non-negative integer and an integer k, remove exactly k digits from num so that the remaining digits form the smallest possible number.

Constraints:

  • 11 \leq k \leq num.length 105\leq 10^5

  • num consists of only digits.

  • num does not have any leading zeros except for the zero itself.

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Remove K Digits

med
30 min
Explore how to solve digit removal problems by applying greedy algorithms. Learn to efficiently remove exactly k digits from a numeric string to form the smallest number possible. Understand constraints and implement your solution with guided practice.

Statement

Given a string, num, that represents a non-negative integer and an integer k, remove exactly k digits from num so that the remaining digits form the smallest possible number.

Constraints:

  • 11 \leq k \leq num.length 105\leq 10^5

  • num consists of only digits.

  • num does not have any leading zeros except for the zero itself.