set12

How many doublings until n customers?

12 / 26
read the snippet · pick its Big-O
// Estimates how many growth cycles until we hit 'target' customers,
// when each cycle doubles. Returns the cycle count.
function cyclesUntil(target) {
let count = 0;
let n = 1;
while (n < target) {
n = n * 2;
count++;
}
return count;
}