```
class Solution {
public:
int removeElement(int A[], int n, int e) {
for(int i=0; i<n; i++){
if(A[i] == e){
A[i] = A[n-1];
n--;
i--;
}
}
return n;
}
};
```