You are viewing a single comment's thread. Return to all comments →
Best Approche Cpp
string superReducedString(string s) { stackstack;
for(char ch : s){ if(!stack.empty()){ if(stack.top() != ch){ stack.push(ch); }else{ stack.pop(); } }else{ stack.push(ch); } } if(stack.empty()){ return "Empty String"; } string ans = ""; while (!stack.empty()) { ans.push_back(stack.top()); stack.pop(); } reverse(ans.begin() , ans.end()); return ans;
}
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 →
Best Approche Cpp
string superReducedString(string s) { stackstack;
}