文章目录 移动零 移动零 class Solution { public: void moveZeroes(vector<int>& nums) { int dest = -1; int cur = 0; while(cur < nums.size()) { if (nums[cur] != 0) { dest++; swap(nums[cur], nums[dest]); } cur++; } } };