As reported: ServiceNow Software Engineer (IC2) loop, round 2 (DSA + HLD), May 2025: this problem and merging two sorted lists, plus a short high-level design question.
Given a non-negative integer num as a string and an integer k, remove k digits so that the remaining number is the smallest possible. Return it as a string without leading zeros ("0" if nothing is left).
This is LeetCode 402 — Remove K Digits.
Example
num = "1432219", k = 3 -> "1219"
num = "10200", k = 1 -> "200"
num = "10", k = 2 -> "0"
Constraints: 1 ≤ k ≤ num.length ≤ 10^5; num has only digits and no leading zeros except "0" itself.
Code runner format: line 1 num (JSON string), line 2 k. Implement removeKdigits(num, k); the harness prints the result string.