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