The real_i is the right position for non-zero element. If "i" is a zero, real_i stay at the original position. All the previous non-zero integer has backed up before real_i.

```
class Solution(object):
def moveZeroes(self, nums):
real_i = 0
for i in xrange(len(nums)):
nums[real_i] = nums[i]
if nums[i] != 0:
real_i += 1
nums[real_i:] = [0]*(len(nums)-real_i)
```