Skip to content

Instantly share code, notes, and snippets.

@eklitzke
Created July 31, 2020 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eklitzke/dc0b8ef8258aa758e5587cda3bdb7551 to your computer and use it in GitHub Desktop.
Save eklitzke/dc0b8ef8258aa758e5587cda3bdb7551 to your computer and use it in GitHub Desktop.
class Solution {
public:
void moveZeroes(vector<int>& nums) {
auto end = nums.end();
for (auto pos = std::remove(nums.begin(), nums.end(), 0); pos != end; ++pos) {
*pos = 0;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment