LC 1047 [E] Remove All Adjacent Duplicates In String - ALawliet/algorithms GitHub Wiki
class Solution:
def removeDuplicates(self, s: str) -> str:
stack = []
for c in s:
if stack and c == stack[-1]:
stack.pop()
else:
stack.append(c)
return ''.join(stack)