We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Strings
- Super Reduced String
- Discussions
Super Reduced String
Super Reduced String
Sort by
recency
|
1741 Discussions
|
Please Login in order to post a comment
Simple Java solution:
def superReducedString(s): stack = []
Using stack : def superReducedString(s): st = [] for ch in s: if not st: st.append(ch) elif st and st[-1] == ch: st.pop() else: st.append(ch) return ''.join(st) if st else 'Empty String'