You are viewing a single comment's thread. Return to all comments →
def beautifulBinaryString(b): m=0 while '010' in b: for i in range(len(b)-2): if b[i]=='0' and b[i+1]=='1' and b[i+2]=='0': m+=1 b=b[i+3:] break return m
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Beautiful Binary String
You are viewing a single comment's thread. Return to all comments →