You are viewing a single comment's thread. Return to all comments →
O(1) solution, PHP
function strangeCounter(int $t): int { $loopNumber = floor(log(($t - 1) / 3 + 1, 2)); return 3 * (2 ** ($loopNumber + 1)) - 2 - $t; }
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 →
O(1) solution, PHP