0

You get get 6 attempts to find the number between 1-100. Each "attempt" can either be a guess, or a range it could fall in, responses you could receive are "Correct!", "My number is lower.", "My number is higher", or "My number is within that range".

You have 6 tries to guess it, NOT to know it.

If you can do it in less than 6 please do post it.

warspyking
  • 14,500
  • 10
  • 78
  • 144

2 Answers2

12

Divide the current range by three and guess the middle range. It's either correct, higher, or lower, which reduces your search space by ⅔. You'll go from a search space of 100 to (worst case) 34, to 12, to 4, to 2, to 1 which you can state on your 6th guess.

SQB
  • 5,118
  • 31
  • 58
2

It is impossible to do this with less than 6 guesses since we are guessing within 1-100. The maximum space we can guess in with less than 6 guesses is $81 = 3^{5-1}$. Less than 5 guesses would be $27$, and so on. However, you could guess in a space of up to $3^{6-1} = 243$ with 6 guesses.

GentlePurpleRain
  • 25,965
  • 6
  • 93
  • 155
Leo
  • 525
  • 4
  • 8