Move Zeroes
Write the code, see it run, pass the checks.
The problem
- easy
- Code
Write moveZeroes(nums): move every 0 in the array nums to the end, keeping the other numbers in the order they were in. Change nums itself, in place, rather than building a new array, and return nothing. An empty array stays empty. For example, after moveZeroes(nums) with nums = [0, 1, 0, 3, 12], nums is [1, 3, 12, 0, 0].
Your code must pass
- Moves the zeros to the end
- Keeps the other numbers in order
- Changes the array in place and returns nothing
- Handles empty and all-zero arrays