void moveZeroes(int* nums, int numsSize) { int head=0,index=0; while(index<numsSize){ if(nums[index]!=0){ nums[head++]=nums[index]; } index++; } for(;head<numsSize;head++) nums[head]=0; }
posted on 2024-03-18 15:39 神奇的萝卜丝 阅读(18) 评论(0) 收藏 举报
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3