Number Guess hides a number in a stated range and tells you after each attempt whether the target is higher or lower. Your task is to find it in as few guesses as possible.
It is a small game with a genuinely useful idea inside it. The optimal approach is binary search, and it is one of the clearest demonstrations of why halving a problem beats scanning it.
Frequently asked questions
- What is the fastest way to guess the number?
- Guess the midpoint of the remaining range each time. This is binary search, and it halves the possibilities with every guess, which is provably optimal.
- How many guesses should it take?
- At most seven for a range of one to a hundred, and at most ten for one to a thousand, provided you halve the range each time.
- Is this useful for learning?
- Yes. It is a clear practical demonstration of binary search and of estimating with ranges, which is why it is often used to introduce the idea to students.