168. move zeros

JavaScriptAlgorithm

medium  - accepted / - tried

Given an array of integers, move zeros to the end while keeping the order of the rest.

You should make the in-place change.

const list = [1,0,0,2,3]moveZeros(list) console.log(list) // [1,2,3,0,0]

What is the time & space complexity of your approach?

Always try to find a better approach.