Problem
Ask
Submissions

Problem: Remove K Digits

Medium
30 min
Explore how to remove exactly k digits from a given numerical string to form the smallest possible number using greedy algorithm techniques. Understand problem constraints, optimize number size, and practice solving this common coding interview challenge effectively.

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.

Problem
Ask
Submissions

Problem: Remove K Digits

Medium
30 min
Explore how to remove exactly k digits from a given numerical string to form the smallest possible number using greedy algorithm techniques. Understand problem constraints, optimize number size, and practice solving this common coding interview challenge effectively.

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.