Problem: You have two identical crystal orbs. you need to figure out how high an orb can fall from a 100 story building before it breaks. you know nothing about the toughness of the orbs: they may be very fragile and break when dropped from the first floor, or they may be so tough that dropping them from the 100th floor doesn't even harm them.
what is the largest number of orb-drops you would ever have to do in order to find the right floor? (i.e. what's the most efficient way you could drop the orbs to find your answer?)
You are allowed to break both orbs, provided that in doing so you uniquely identify the correct floor.
Solution:
14.
Drop first orb from floors 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99, 100... (ie move up 14 then 13, then 12 floors, etc) until it breaks (or doesn't at 100). Call the first floor at which it breaks n and the previous tested floor n'. Then try the intervening floors (n'+1 .. n'-1) with the other orb.
Worst case is if correct floor is 13,14,26,27, etc which require m drops with the first orb and 14-m drops with the second.
No comments:
Post a Comment