Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
stack solution in Clear category for Adjacent Letters by Phil15
def adjacent_letters(line: str) -> str:
stack = []
for s in line:
if stack and stack[~0] == s:
stack.pop()
else:
stack.append(s)
return ''.join(stack)
Sept. 12, 2022
Comments: