โ† All coding problems

Move zeros to the end

MediumTwo pointers

Return a new array with every 0 in nums moved to the end, keeping the order of the other numbers.

Function
function solve(nums)
Example 1
nums = [0,1,0,3,12]
โ†’ [1,3,12,0,0]

Submit also runs 3 hidden tests, including edge cases.

console.log output is shown below