Practice Clear Digits
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given s, repeatedly delete its first digit together with the closest non-digit character to that digit’s left. A digit with no non-digit character to its left cannot be processed by this operation. Return the string after removing all digits as required by the input.
Source: Clear Digits on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "abc"
Output
"abc"
# Example 2
Input
s = "cb34"
Output
""
Constraints
1 <= s.length <= 100
s consists only of lowercase English letters and digits.
The input is generated such that it is possible to delete all digits.
Related LeetCode Problems
Practice more problems similar to Clear Digits.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.