wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Guess my number: Your friend chooses an integer between 0 and 100. You have to find out that number by asking questions, but your friend can only answer 'yes' or 'no'. What strategy would you use?

Open in App
Solution

Given,
The number chosen is between 0 and 100
Let the number be x

I would use the strategy of dividing the interval of possibilities in half after every yes or no answer.

First question would be : whether x lies in [0,50]?
If yes, then next question would be : whether x lies in [0,25]?
If no, then next question would be : whether x lies in [50,75]?

Every next question would be based on the previous answer.
In this way, the interval would be smaller and smaller after every answer and eventually lead to the number in minimum number of questions asked.

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
The Number Line
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon