Problem
Given a list of integers nums, move every 0 to the end in place, keeping the non-zero values in their original relative order. Do not return anything and do not build a new list: change nums itself.
Example 1
- Input
- nums = [0, 1, 0, 3, 12]
- Output
- nums becomes [1, 3, 12, 0, 0]
Example 2
- Input
- nums = [0]
- Output
- nums stays [0]
Example 3
- Input
- nums = [4, 0, 5]
- Output
- nums becomes [4, 5, 0]
Constraints
0 <= nums.length <= 10^4-2^31 <= nums[i] <= 2^31 - 1Use O(1) extra space.