Given an integer array nums, move all 0s to the end while keeping the relative order of the non-zero elements. Do this in place, then return the array.
Example 1
Input: nums = [0,1,0,3,12]
Output: [1,3,12,0,0]
Example 2
Input: nums = [0]
Output: [0]
Constraints
1 <= nums.length <= 10000-1000000 <= nums[i] <= 1000000Follow-up: can you do it in a single pass, minimising the number of writes?
Input
nums = [0,1,0,3,12]
Expected
[1,3,12,0,0]
4 hidden tests run on submit