# Leetcode 283. Move Zeroes Runtime: 1 ms faster than 63.20% Memory Usage: 40.4 MB less than 46.09% ```java= class Solution { public void moveZeroes(int[] nums) { int index=0; for(int num : nums){ if(num!=0){ nums[index]=num; index++; } } for(int i=index;i<nums.length;i++){ nums[index]=0; index++; } } } /* 解題思維: 設一個index,若值非0 則 nums[index]=num,若是0 則跳過 最後再用一個for迴圈,從index的地方開始跑到整個字串的長度 補0 */ ``` ###### tags: `Array`