We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defstrangeCounter(t):# Write your code here#base case of t in bucket 0ift<=3:return3-t+1#determine what bucket t is infloor=3ceiling=9bucket=0forninrange(1,1000000):ift>floorandt<=ceiling:bucket=nbreakelse:floor=ceilingceiling=3*2**(n+1)+floorreturn3*2**bucket-(t-floor-1)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Strange Counter
You are viewing a single comment's thread. Return to all comments →
python solution