标签:int .com tor ret com get cto end nbsp
代码1:
1 class Solution { 2 public: 3 void moveZeroes(vector<int>& nums) 4 { 5 int count = 0; 6 for(auto beg = nums.begin(); beg != nums.end(); ++beg) 7 if(*beg == 0) 8 ++count; 9 if(count == nums.size() || count == 0) 10 return; 11 int k = 0; 12 for(int i = 0; i < nums.size(); ++i) 13 if(nums[i] != 0) 14 nums[k++] = nums[i]; 15 while(count--) 16 nums[k++] = 0; 17 } 18 };
标签:int .com tor ret com get cto end nbsp
原文地址:https://www.cnblogs.com/sunbines/p/9612800.html