ByteByteGo logo
menuProblems List

Repeated Removal of Adjacent Duplicates

Easy

Given a string, continually perform the following operation: remove a pair of adjacent duplicates from the string. Continue performing this operation until the string no longer contains pairs of adjacent duplicates. Return the final string.

Example 1:

Input: s = 'aacabba'
Output: 'c'

Example 2:

Input: s = 'aaa'
Output: 'a'

You can practice coding exercises online by logging into bytebytego.com on your laptop.