5 comments

[ 3.1 ms ] story [ 27.1 ms ] thread
For people wondering about the hourglass problem: 1) @0min: Take both glasses (4 & 7) and flip them over. 2) @4min: When the 4min glass is empty, flip it back over 3) @7min: When the 7min glass runs out, flip it back over. 4) @8min: when the 4min glass is empty, there will be 1 minute in the 7min glass. Flip the 7 glass. 5) @9min: When the 7min glass runs out, you will be at 9min.
For the 20 destructible bulbs and 100 floors, what's the fewest number of tries? I thought of this way: start at floor 50 and drop bulb 1. If it breaks, go to floor 25, if not, go to floor 75. Keep going to the floor halfway between the last floor and the boundary you want to test. You can do it in about 8 tries. Is there a way to do it in fewer tries?
I think that's the way to work it and it relates to how a look up is performed in a database.
Always have to be on the lookout for trick questions (i.e. Tesla Motor's question on water displacement). My rule of thumb: when presented with two discrete options, assume a third one also exists.