Skip to main content

Time Complexity · #24 · 2026-04-28

What's the Big-O?

JavaScript ·Difficulty 1/3

How to play

Read the code and pick its time complexity from four Big-O choices. Think about loops, recursion, and hidden costs. Press 1–4 or click to answer.

What is the time complexity?

function f(n) {
  let count = 0;
  let i = 1;
  while (i < n) {
    count++;
    i *= 2;
  }
  return count;
}

Loading your progress...

Press 1 through 4, or tap a numbered choice, to answer. Back to hub