Leetcode 1209. Remove All Adjacent Duplicates in String II
Given a string s and integer k, repeatedly remove any run of k equal adjacent characters until no more removals are possible and return the final string. The core challenge is to handle cascading deletions efficiently by tracking consecutive character counts (often via a stack of character-count pairs) rather than rescanning the string.
Asked at:
Apple
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late September, 2025
Meta
Senior
Early September, 2025
Meta
Senior
Early July, 2025
Meta
Staff
Your account is free and you can post anonymously if you choose.