```
class Solution {
public:
void moveZeroes(vector<int>& nums) {
int l=0, r=0;
int len = nums.size();
/* Look for the first zero and initialize l, r to it. */
while(nums[l] != 0 && l < len) {
l++;
}
r = l;
while(r < len) {
/* Look for next non-zero and copy that to lth position, increament l */
if(nums[r] != 0) {
nums[l] = nums[r];
l++;
}
r++;
}
/* Copy zero at remaining positions */
while(l<len) {
nums[l] = 0;
l++;
}
}
};
```