Refer to the comments. Happy to share my first attempt Accepted solution :)

I used "Counting Sort" idea and tried to make code easy to understand.

```
void moveZeroes(vector<int>& nums) {
int index=0;
int zcount=0;
// let's count the number of 0 and move all non-0 to their final positions (to track that position I use index)
for(auto it = nums.begin(); it != nums.end(); ++it){
if(*it == 0)
++zcount;
else
nums[index++] = *it;
}
// we are done here with moving all non-0 to their positions
// we know the last position in the array where 0s should start from - index
// also, we know the number of 0s in the array - zcount
// let's put all 0s in there places here
while(index < nums.size())
nums[index++]=0;
}
```

Update according to comments from ftbmynameis

```
void moveZeroes(vector<int>& nums) {
int index=0;
int N = nums.size();
for(int i = 0; i < N; ++i){
if(nums[i] != 0){
if(i != index){
nums[index] = nums[i];
nums[i]=0;
}
++index;
}
}
}
```