Given an integer array nums, move all 0's to the end while maintaining the relative order of the non-zero elements. Return the resulting array.
nums
0
nums = [0,1,0,3,12]
[1,3,12,0,0]
nums = [0]
[0]
1 <= nums.length <= 10^4 -2^31 <= nums[i] <= 2^31 - 1
Topics
Implement moveZeroes in the editor and return the answer — printing it is never graded.
moveZeroes
Problem 8 of 1146 in the arena