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]);
}
}
}
leetcode-283-这样写为什么报错?
猜你喜欢
转载自blog.csdn.net/Edidaughter/article/details/121050889
今日推荐
周排行