You are viewing a single comment's thread. Return to all comments →
n = int(input()) count=0 max1s=0 while(n>0): if(n%2==0): count=0 else: count+=1 if(count>max1s): max1s=count n=n//2 print(max1s)
n = int(input())
count=0 max1s=0 while(n>0): if(n%2==0): count=0 else: count+=1 if(count>max1s): max1s=count n=n//2 print(max1s)
this reduces the time complexity and space complexity(?)
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
this reduces the time complexity and space complexity(?)