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

```
Input:
[1]
1
Output:
[1]
Expected:
[]
```