← Back to all problems
Medium

Remove K Digits

Updated Feb 24, 2026

Problem

Remove k digits to make the smallest possible number string.

Constraints

1 <= num.length <= 10^5

Examples

Example 1

Input: {"num": "1432219", "k": 3}
Output: "1219"

Function Signature

def removeKdigits(self, num: str, k: int) -> str

How to Submit

Implement a Solution class with a removeKdigits method.

Your method will be called with the input parameters and should return the answer.