Search
⌘K

Leetcode 3561. Resulting String After Adjacent Removals

Repeatedly delete the leftmost adjacent pair of letters that are consecutive in the alphabet (treating 'a' and 'z' as consecutive) until no such pairs remain, and return the resulting string. This is a greedy/stack-like simulation solvable in linear time for the given length constraint.


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.

Leetcode 3561. Resulting String After Adjacent Removals | Hello Interview