Untitled
user_9124840
plain_text
13 days ago
338 B
1
Indexable
Never
class Solution { public: string removeDuplicates(string s) { string ans = ""; for (char ch : s) { if (ans.empty() || ch != ans.back()) { ans.push_back(ch); } else { ans.pop_back(); } } return ans; } };
Leave a Comment