

InterviewSolution
1. |
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 ? |
Answer» Let my friend choosen 73; then my questions may be like this. Q : Does it lie in the first 50 numbers ? A: No . Q : Does it lie between 50 and 60 ? A: No Q : Does it lie between 60 and 70 ? A: No Q : Does it lie between 70 and 80 ? A: Yes [then my guess would be “it is a number from 70 to 80] Q : Is it an even number ? A: No [my guess : it should be one of the numbers 71, 73, 75, 77 and 79] Q : Is it a prime number ? A: Yes [my guess : it may be 71, 73 or 79] Q : Is it less than 75 ? A: Yes [my guess : it may be either 71 or 73] Q : Is it less than 72 ? A: No Then the number is 73. Therefore the strategy is → Use number properties such as even, odd, composite or prime to determine the number. |
|