Search⌘ K
AI Features

Solution: Clear Digits

C# solution for the Clear Digits problem using the Stacks pattern.

We'll cover the following...

Statement

You are given a string s containing lowercase English letters and digits. Repeatedly perform the following operation until no digits remain in s:

Choose any digit character in s, delete that digit, and also delete the closest lowercase letter to its left.

Return the final string after all possible operations have been applied.

Note: The input is constructed so that every digit can be removed by repeatedly deleting a digit together with a letter to its left.

Constraints:

  • 11 \leq ...