SyntaxFix
Write A Post
Hire A Developer
Questions
How about this?
void squeeze(vector<int> &v) { int j = 0; for (int i = 1; i < v.size(); i++) if (v[i] != v[j] && ++j != i) v[j] = v[i]; v.resize(j + 1); }