TheAlgorithms-C/leetcode/src/283.c

11 lines
235 B
C
Raw Normal View History

2019-09-26 23:29:31 +08:00
void moveZeroes(int* nums, int numsSize){
int i, start = 0;
for (i = 0; i < numsSize; i++) {
if(nums[i])
nums[start++] = nums[i];
}
for(;start < numsSize; start++) {
nums[start] = 0;
}
}