easiest C++ answer


  • -2
    L

    C++
    bool isOneBitCharacter(vector<int>& bits) {
    int num=0;
    for (int i=0;i<bits.size()-1;i++)
    {
    if (bits[i]==0)num=0;
    else num++;
    }
    if (num%2==0)return true;
    else return false;
    }


Log in to reply
 

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