Problems > Bacteria in a Dish > Editorial

Bacteria in a Dish — Solution & Editorial

Back to the Problem

Double at most ~60 times before exceeding any 64-bit cap — loop with an early break at C, never computing 2H blindly.

Complexity: O(1) or O(log)

Watch out: 2H for H = 109 overflows everything — break out as soon as the cap is hit.