* You are given 2 eggs.
* You have access to a 100-story building.
* Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor. Both eggs are identical.
* You need to figure out the highest floor of a 100-story building an egg can be dropped without breaking.
* Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process
Why do people say this..
Quote
Start at the 14th floor, and then go up 13 floors, then 12, then 11, then 10, 9, 8, 7, 6, 5, 4 until you get to the 99th floor, then here. If the egg were to break at the 100th floor, it would take 12 drops (or 11 if you assume that it would break at the 100th floor). Say, for example, that the 49th floor was the highest floor, the number of drops would be the 14th, 27th, 39th, 50th (the egg would break on the 50th floor) plus the 40, 41,42,43,44,45,46,47,48, and 49th floor for a total of 14 drops.
Isn't it a lot more efficient to test on the 50th floor, then 25th or 75th depending if it breaks, diving the floors by 2?
The amount of falls is x, where 2^x > 100 ... x = 7, so a worst case scenario would only require 7 drops. E.g (if egg breaks from 87th floor, one of the worst case scenarios): 50, 75, 88, 81, 84, 86, 87 = 7 drops
This post was edited by Foxic on May 11 2013 02:51am