Remove All Adjacent Duplicates In String
Easy
Topics
Given a string s, repeatedly remove two adjacent equal letters until no more can be removed. Return the final string.
Example 1
Input: s = "abbaca" Output: "ca"
Example 2
Input: s = "azxxzy" Output: "ay"
Constraints
- 1 <= s.length <= 10^5
- s consists of lowercase English letters.
Run ⌘' · Submit ⌘⏎