leetcode-283-这样写为什么报错?

void swap(int *a, int *b) {
    int t = *a;
    *a = *b;
    *b = t;
}

void moveZeroes(int *nums, int numsSize) {
    int moveStep = 0;
    for(int i = 0;i<numsSize;i++) {
         if(nums[i]==0) {
             moveStep++;
         } else {
             swap(nums[i],nums[i-moveStep]);
         }
    }
}

猜你喜欢

转载自blog.csdn.net/Edidaughter/article/details/121050889