Whats wrong with my code


  • 0
    P

    if(A.length==0){
    return 0;
    }
    int newSize =1;
    int ln=1;
    for(int j=0;j<A.length-1;j++){
    if(A[j]==A[newSize]){
    newSize++;
    }else {
    ln++;
    newSize++;
    }
    }
    return ln;

    its working perfectly in my system not here?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.