地址:https://leetcode-cn.com/problems/remove-element/
思路:覆盖操作即可
Code:
#include<iostream>
#include<vector>
#include<set>
using namespace std;
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int l=0;
for(int i=0;i<nums.size();++i)
if(nums[i]!=val) nums[l++]=nums[i];
return l;
}
};
int main()
{
return 0;
}