class Solution {
public:
int removeElement(int A[], int n, int elem) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int num = 0;
for(int i=0;i<n;i++){
if(A[i]==elem)
num++;
else
A[i-num] = A[i];
}
return n-num;
}
};
public:
int removeElement(int A[], int n, int elem) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int num = 0;
for(int i=0;i<n;i++){
if(A[i]==elem)
num++;
else
A[i-num] = A[i];
}
return n-num;
}
};