Number Guessing Game
Guess the secret number. Use the clues to close in!
Select a difficulty to start!
Guesses
Frequently Asked Questions
What is the optimal strategy for the number guessing game?▼
Binary search is the mathematically optimal strategy: always guess the midpoint of the remaining possible range. For 1–100: guess 50 first. If too high, guess 25. If too low, guess 75. This guarantees finding any number in at most 7 guesses for 1–100 (log₂(100) ≈ 6.64). For 1–1000, binary search finds the answer in at most 10 guesses.
What is binary search?▼
Binary search is an algorithm for finding a target value in a sorted list by repeatedly halving the search space. It's one of the most efficient search algorithms — O(log n) time complexity. Compare: a linear search through 1,000 items takes up to 1,000 steps; binary search takes at most 10. Binary search underlies many real-world systems including database indexes, phone book lookups, and version control bisect tools.