A simple C solution [Accepted]


  • 0
    B
    bool isOneBitCharacter(int* bits, int bitsSize) {
        bool result=true;
        if(bitsSize==1)
        {
            if(bits[0]==0) return true;
            else return false;
        }
        if(bitsSize==0) return false;
        if(bits[0]==0) result=isOneBitCharacter(&bits[1],bitsSize-1);
        if(bits[0]==1)  result=isOneBitCharacter(&bits[2],bitsSize-2);
        return result;
    }
    

Log in to reply
 

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