class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int removecount=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]==val)
removecount++;
else
nums[i-removecount]=nums[i];
}
return nums.size()-removecount;
}
};
public:
int removeElement(vector<int>& nums, int val) {
int removecount=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]==val)
removecount++;
else
nums[i-removecount]=nums[i];
}
return nums.size()-removecount;
}
};