Simple Java solution


  • 0
    A
    class Solution {
        public boolean isOneBitCharacter(int[] bits) {
            int l = bits.length;
            boolean flag = false;
            for(int i=0;i<l;){
                int c = bits[i];
                if(c == 0){
                    if(i == l-1)
                        flag = true;
                    i++;
                }else{
                    i = i + 2;
                }
            }
            
            return flag;
            
        }
    }
    

Log in to reply
 

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