You are viewing a single comment's thread. Return to all comments →
def superReducedString(s): stack = [] for char in s: if stack and stack[-1] == char: stack.pop() else: stack.append(char) result = ''.join(stack) return result if result else 'Empty String'
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →