解题思路:和上边的找重复的其实是差不多的题。
具体代码:
int removeElement(vector<int>& nums, int val) {
int j = nums.size();
int left = 0;
for (int i = 0; i < j; i++)
{
if (nums[i] != val)
{
nums[left] = nums[i];
left++;
}
}
return left;
}