Data Structure and Algorithm Remove Element 27. Remove Element C++代码 1 2 3 4 5 6 7 8 9 10 class Solution { public: int removeElement(vector<int>& nums, int val) { int k = 0; for (int i = 0; i < nums.size(); i ++ ) if (nums[i] != val) nums[k ++ ] = nums[i]; return k; } };