LeetCode 283 Move Zeroes
LeetCode 283 Move Zeroes
void moveZeroes(int* nums, int numsSize) { int i=0,j=0; for(i;i<numsSize;) { if(nums[i]==0) { while(nums[j]==0 && j<numsSize-1) j++; nums[i]=nums[j]; nums[j]=0; } if(++i>j) j=i; } }
LeetCode 283 Move Zeroes
void moveZeroes(int* nums, int numsSize) { int i=0,j=0; for(i;i<numsSize;) { if(nums[i]==0) { while(nums[j]==0 && j<numsSize-1) j++; nums[i]=nums[j]; nums[j]=0; } if(++i>j) j=i; } }