Throughing TLE for this solution pls tell where i'm going wrong

programming
Tags: #<Tag:0x00007f242cdc3168>

#1

public static int removeDuplicates(ArrayList A) {
int i=0;
int j=1;
int n=A.size();
boolean see=true;
int count=0;
while(j<=n-1){

        if(A.get(i).equals(A.get(j))){
            if (count<1){
                j++;
                count++;


            }else{
                A.remove(j);
                n=A.size();
                if (j==n)break;
            }

        }else{
          count=0;
            i=j;
            j=i+1;
        }
    }
return A.size();
}