···
if not bits: return False
n = len(bits)
index = 0
while index < n:
if index == n-1 : return True
if bits[index] == 1:
index += 2
else: index += 1
return False
···
@rsquare slight change , in the below line
if index == n-1 and bits[index]==0 : return True
@sandeep.maxcraze Thanks, but may not necessary for this problem, the given string will always end with a 0.