Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param {number[]} nums
- * @return {void} Do not return anything, modify nums in-place instead.
- */
- var moveZeroes = function(nums) {
- let i = 0, max = nums.length;
- while(i < max) {
- if (nums[i] === 0) {
- nums.splice(i, 1);
- nums.push(0);
- max--;
- } else {
- i++;
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement