Simple C++ solution (2ms)


  • 0
    S
    bool isOneBitCharacter(vector<int>& bits) {
            bool oneBit{};
            
            size_t jj = 0;
            while (jj < bits.size()) {
                if (bits[jj] == 0) {
                    oneBit = true;
                    ++jj;
                }
                else {
                    oneBit = false;
                    jj += 2;
                }
            }
            
            return oneBit;
        }
    

Log in to reply
 

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