Practice Lexicographically Smallest String After Adjacent Removals
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Lexicographically Smallest String After Adjacent Removals
Problem Statement
Given lowercase s, you may repeatedly remove any adjacent pair whose letters are consecutive in the circular alphabet, in either order; a and z are consecutive. Close the gap after each removal. Return the lexicographically smallest string obtainable, including the option to perform no removals.
Source: Lexicographically Smallest String After Adjacent Removals on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "abc"
"a"
# Example 2
s = "bcda"
""
# Example 3
s = "zdce"
"zdce"
Constraints
Related LeetCode Problems
Practice more problems similar to Lexicographically Smallest String After Adjacent Removals.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.