solulubeta
Sign in
Story Problems / Greedy
06.16 · Problem

Erase K Digits for the Smallest Number

Hard Monotonic stack (drop larger digit before a smaller one) Pro

This problem is part of solulu Pro

A number is written as a string of digits. Remove exactly k digits so that the remaining number is as small as possible. Return it as a string with no leading zeros (return "0" if nothing is left).

Lifetime ₹2,000 ₹1,000 · Beta offer
Mark this problem as solved when you are finished.

Item 70 of 94 · updated 2026-10-12