Definition is vague, answer is simple


  • 2

    Just count how many continous 1's prior to the final 0.

        public boolean isOneBitCharacter(int[] bits) {
            if (bits == null) return false;
            boolean one = false;
            int i = bits.length - 2;
            while (i >= 0 && bits[i--] == 1) {
                one = one ^ true;
            }
            return !one;
        }
    

Log in to reply
 

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