Untitled
user_9124840
plain_text
16 days ago
355 B
2
Indexable
Never
class Solution { public: string clearDigits(string s) { string ans = ""; for (char ch : s) { if (ch >= '0' && ch <= '9') { if (!ans.empty()) { ans.pop_back(); } } else ans.push_back(ch); } return ans; } };
Leave a Comment