You are viewing a single comment's thread. Return to all comments →
#!/bin/python3 import sys import math n = int(input().strip()) k=int(math.log(n,2))+1 j=0 c=0 l=[] while(j<k): if(n & 1<<j): c+=1 else: l.append(c) c=0 j+=1 l.append(c) print(max(l))
Seems like cookies are disabled on this browser, please enable them to open this website
Consecutive 1's in Binary Numbers
You are viewing a single comment's thread. Return to all comments →