Getting TLE for my submission


#1

Getting TLE for the below code
Can anyone help me with this?
public int removeElement(ArrayList a, int b) {
while(a.remove((Integer)b));

    return a.size();
}

#2

@PritamChakraborty First bring all elements that are not equal to b to the left and then start removing the elements.