```
class Solution {
public:
void moveZeroes(vector<int>& nums) {
int n = nums.size();
int left = 0, right = 0;
while (right < n){
if (nums[right] != 0 && nums[left] == 0){
swap(nums[left], nums[right]);
left++;
}
if (nums[left] != 0)
left++;
right++;
}
}
};
```