Getting MLE for all the cases


This is my code :

int Solution::removeElement(vector &A, int B) {

int n=A.size();
int l=0;
for(int i=0;i<n;++i){


return A.size();

I’ve tried :

  1. erasing the not needed elements
  2. filling the unnecessary elements with zeroes and then returning
  3. directly returning the new size without making any changes to the vector
    In all of these cases it’s giving MLE , I think there’s something wromg with the judge.