Problem: Move zeroes to end, maintain order. In place.
function moveZeroes(nums):
write = 0
for read from 0 to nums.length - 1:
if nums[read] != 0:
nums[write] = nums[read]
write++
for i from write to nums.length - 1:
nums[i] = 0
Alternative: Swap non-zeros to front in single pass.
Time: . Space: .