5 ms·
>> Log_2 1000. Actually that's the maximum number of guesses needed (assuming you're aware of the binary search concept), not the minimum. The minimum is 1.
by georgemcbay 16y ago
>> Log_2 1000.
Actually that's the maximum number of guesses needed (assuming you're aware of the binary search concept), not the minimum. The minimum is 1. This is a trick question and you have failed the first interview question and have been shown the door... Good illustration of why the questions are, in fact, ridiculous unless they are just used as a "jumping off" point for discussion (which is rarely what happens, IME).
- wlievens 16y agoI call bullshit. The minimum number of questions is this context implies the minimum number you need to ask to be guaranteed to find a solution. Any other interpretation is meaningless. But of course, the safe answer would be to explain it in the verbose way and not just shout out "TEN".
- aphyr 16y agoI considered this, but rejected it. If you interpret the problem in this way the answer is dependent on an undefined parameter. The clearest interpretation of the problem, the most useful interpretation of the problem, and also a nontrivial interpretation, is "what is the lowest upper bound on the number of guesses".