1 class Solution(object): 2 def isOneBitCharacter(self, bits): 3 """ 4 :type bits: List[int] 5 :rtype: bool 6 """ 7 if len(bits) < 2: 8 return True 9 num = 0 10 for i in range(len(bits) - 2, -1, -1): 11 if bits[i] == 1: 12 num += 1 13 else: 14 break 15 if num % 2 == 0: 16 return True 17 else: 18 return False 19 20 21 if __name__ == '__main__': 22 solution = Solution() 23 print(solution.isOneBitCharacter([1, 0, 0]))