Given an integer array nums, move all 0 values to the end of the array while preserving the relative order of the non-zero elements. Modify the array in place and return the resulting array.
Constraints
1 <= nums.length <= 10^5
-2^31 <= nums[i] <= 2^31 - 1
The relative order of non-zero elements must be preserved
Modify the array in place
Function Signature
defmove_zeroes(nums):
Interviewer
Your question is Move Zeros to Array End. Start with the requirements in the Question tab.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.