C++code easy to understand


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

Log in to reply
 

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