使用双指针法(快慢指针法)
int removeElement(vector<int>& nums, int val)
{
int lowIndex = 0;
int fastIndex = 0;
while(fastIndex<nums.size()){
if (nums[fastIndex]!=val){
nums[lowIndex]=nums[fastIndex];
lowIndex++;
}
fastIndex++;
}
return lowIndex
}