Js Solution


  • -1
    Z

    var moveZeroes = function(nums) {
    var _start = 0;
    for(var i = 0 ;i <nums.length;i++){
    if(nums[_start]!=0){
    _start++;
    continue;
    }
    (function(index){
    nums.splice(index,1);
    nums.push(0);
    })(_start)
    }
    };


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.