Search
⌘K

Leetcode 3174. Clear Digits

Given a string of lowercase letters and digits, repeatedly remove each digit together with the nearest non-digit to its left until no digits remain, and return the final string. This can be solved by simulating a stack/greedy left-pairing: when you see a digit, pop the most recent letter to its left.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.