Let me tell you how this works:

We take 0 as our pivot ,like in quicksort. All the elements which are not 0 are swapped with the number of index 'j'. So, automatically , all the zeroes will be at the end of the array.

```
int i=-1,j=0;
while((++i)<nums.size())
if(!(nums[i]==0))
swap(nums[i],nums[j++]);
```