Remove K Digits Problem

Remove K Digits Problem — ExecCode Easy DSA Practice

Solve the Remove K Digits problem on ExecCode. Free online easy DSA practice in Stack. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num.

Examples

Input {"num": "1432219", "k": 3}; Output 1219. Input {"num": "10200", "k": 1}; Output 200. 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.

Practice Remove K Digits free on ExecCode. Browse DSA problems, topic map, and placement guides.