Determine the hidden number by asking whether your current guess is too high, too low, or correct.
You are trying to determine a hidden integer in a known range by repeatedly making guesses. After each guess, you receive feedback telling you whether the hidden number is smaller, larger, or equal to your guess.
Your task is to find the hidden number using as few guesses as possible by choosing each next guess based on the feedback you receive.
This is an interactive-style practice problem: the essential idea is to narrow the search interval until the number is identified.
At every step, compare the current guess with the hidden value and shrink the search range accordingly. The natural strategy is binary search over the answer.
The exact interactive protocol is unknown from the provided metadata. In general, a solution repeatedly queries a candidate number and receives feedback of the form:
Output guesses according to the interactive protocol until the hidden number is identified.
The hidden number is assumed to lie in a finite integer interval. Use a strategy that finishes in logarithmic time with respect to the size of the interval.
Example 1
Input
Hidden number = 42
Output
Guess 50 -> smaller Guess 25 -> larger Guess 37 -> larger Guess 43 -> smaller Guess 40 -> larger Guess 41 -> larger Guess 42 -> correct
Explanation
This illustrates the binary-search process: each response narrows the range until the answer is found.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.