leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
0027.cpp (225B)
1 class Solution { 2 public: 3 int removeElement(vector<int> &nums, int val) { 4 int j = 0; 5 for (int i = 0; i < nums.size(); i++) 6 if (nums[i] != val) nums[j++] = nums[i]; 7 8 return j; 9 } 10 };