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
|
1719 Discussions
|
Please Login in order to post a comment
solution in python
def superReducedString(s): # Write your code here pat=r'(.)\1' while True: rs=re.sub(pat,'',s) if s==rs: break s=rs return 'Empty String' if len(s)==0 else s
def superReducedString(s): # Write your code here pat=r'(.)\1' while True: rs=re.sub(pat,'',s) if s==rs: break s=rs return 'Empty String' if len(s)==0 else s
Here is my c++ solution, you can watch the explanation here : https://youtu.be/XgJKCkb1EjQ
Here's my solution in typescript. Strings are immutable in JS and I don't think creating an array is efficient using String.prototype.split('') and then again converting it into a string using Array.prototype.join([ ])
Perl regex desicion: