标签:
class Solution { public: int removeElement(vector<int>& nums, int val) { vector<int> new_nums; int i=0; int s=nums.size(); while(i<s){ if(nums[i] == val){ i++; continue; } else{ new_nums.push_back(nums[i]); i++; } } nums.clear(); nums=new_nums; return nums.size(); } };
标签:
原文地址:http://www.cnblogs.com/julie-yang/p/4696581.html