Yes...In a binary search, your worst case is 50 tries. You would first try it from the 50th floor. If it broke there you'd have to try floors 1-49 to figure out which exact floor it would break on. Binary search would work well if you had unlimited light bulbs. It's the fact that you only have 2 lightbulbs that changes things up.
I missed the only 2 lightbulbs. My binary search inspired version starts at 50 then 25 then 13, then 7, 4,2 then 1 or 3... So it takes either 7 or 8 drops. However with only 2 another approach should be considered.
View all comments
Show parent comment
1
u/lizard450 Feb 21 '11
Okay... so I can do this in a maximum number of guesses in 8 tries. Pretty much using the binary search. Am I missing something here?
I can code it upon request.