题目:
解法:
class Solution {
public:void moveZeroes(vector<int>& nums) {fill(remove(nums.begin(), nums.end(),0), nums.end(), 0);}
};
解法二:
void moveZeroes(vector<int>& nums) {int last = 0, cur = 0;while(cur < nums.size()) {if(nums[cur] != 0) {swap(nums[last], nums[cur]);last++;}cur++;}
}