Tap here to switch tabs
Problem
Submissions

Problem: Remove K Digits

Remove K Digits asks you to delete exactly k digits from a non-negative integer string and return the smallest number that can be formed from the remaining digits.

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:

  • 1≤1 \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
Submissions

Problem: Remove K Digits

Remove K Digits asks you to delete exactly k digits from a non-negative integer string and return the smallest number that can be formed from the remaining digits.

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:

  • 1≤1 \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.