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
|
1710 Discussions
|
Please Login in order to post a comment
Solution using Stack in java:
Here is my c++ solution, you can watch the explanation here : https://youtu.be/XgJKCkb1EjQ
SWIFT
c++ solution without erasing or adding stuff to data structures - using previous left and right (pl and pr) indexes and an array to store elements that have been "erased" (used vector).
string superReducedString(string s) { int n = s.size(); vector used(n,false); int pl = -1, pr = -1;