Easy Java Solution


  • 0
    X
    public boolean isOneBitCharacter(int[] bits) {
            if(bits.length==0){
                return false;
            }
            if(bits.length==1){
                return true;
            }
            int len=bits.length-1;
            int index=0;
            while(index<=len){
                if(index==len){
                    return true;
                }
                if(bits[index]==1){
                    index++;
                }
                index++;
            }
            return false;
        }
    

Log in to reply
 

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