You are viewing a single comment's thread. Return to all comments →
Simple understandable O(log n) solution. Passing all Test cases.
def strangeCounter(t): curr_cycle = 1 curr_time = 1 prev_time = 1 while(curr_time<= t): prev_time = curr_time prev_value = 2**(curr_cycle-1)*3 curr_time = curr_time + prev_value curr_cycle+=1 return prev_value - (t-prev_time)
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 →
Simple understandable O(log n) solution. Passing all Test cases.