image_2021-12-09_02-58-54.png
28.4 KB
#N283. Move Zeroes
problem link
#solution
problem link
#solution
class Solution {
public void moveZeroes(int[] nums) {
int index = 0;
for (int n: nums)
if(n != 0)
nums[index++] = n;
while(index<nums.length)
nums[index++] = 0;
}
}