About this Big-O notation quiz
Practice time complexity analysis for coding interviews. Each question shows a short code snippet and asks for its Big-O complexity, from O(1) and O(log n) to O(n log n), O(n²) and O(2ⁿ), with an explanation after every answer.
How to use the Big-O Complexity Quiz
- Read the code snippet.
- Pick its time complexity.
- Read the explanation and continue.
Example
for (i = 1; i < n; i *= 2) → O(log n)
Frequently asked questions
Why are constants dropped in Big-O?
Big-O describes growth as n becomes large, so O(2n) and O(n) grow the same way and are both written O(n).
What is the complexity of a hash map lookup?
O(1) on average, O(n) in the worst case when many keys collide.
Is my data safe?
Yes. The tool runs entirely in your browser using WebAssembly. Nothing you type or upload is sent to a server, logged or stored.
Is it free?
Yes, completely free with no sign-up, no limits and no watermarks. It also works offline once the page has loaded.