[LeetCode] 283. Move Zeroes (JavaScript)


[LeetCode] 283. Move Zeroes (JavaScript)

https://leetcode.com/problems/move-zeroes/ Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 배열이 주어지면 0을 무조건 맨 끝으로 옮기는 아주 간단한 문제였다. splice와 push를 이용해 풀어주었다. /** * @param {number[]} nums * @return {void} Do not return anything, modify nums in-place instead. */ let moveZeroes = function (nums) { for (let i = nums.length - 1; i >= 0; i--) { { if (nums[i] === 0) { nums.push(0); nums.splice(i, 1);...


#leetcodeMovezerosjavascript

원문링크 : [LeetCode] 283. Move Zeroes (JavaScript)