class Solution {
public:
string removeDuplicates(string s) {
string st;
for(auto c:s)
{
if(st.empty() || st.back()!=c)
{
st.push_back(c);
}
else
{
st.pop_back();
}
}
return st;
}
};
leetcode每日一题第105天
最新推荐文章于 2024-07-20 22:34:59 发布