You are viewing a single comment's thread. Return to all comments →
python 3
def beautifulBinaryString(b): l = list(b) steps = 0 for i in range(len(b)-2): if "".join(l[i : i + 3]) == '010': steps += 1 if i + 3 < len(b) and l[i + 3] == '1': l[i + 2] = '1' else: l[i + 1] = '0' return steps
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Binary String
You are viewing a single comment's thread. Return to all comments →
python 3