Wednesday, November 24, 2010

Egg strength - One puzzle a day - Puzzle Buddies

Puzzle:
1.You have 2 eggs.
2.There's a 100-storey building and you have access to all the floors.
3. Eggs have a particular strength. They will break if dropped from a particular floor and above only.
4. Both eggs are identical.
4. You need to figure out the highest floor of a 100-storey 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
Solution: Correct answer is 14. Move 14, then 13, then 12, then 11 and so on.
If you drop the first egg from floor 14,27, 39, 50, 60, 69, 77, 84, 90, 95, 99, 100. It can break at any place. If it does you have to check all the floors between last checked floor current floor. In worst case first egg can break from 14th floor and you have to try 1 to 13.
This is most optimal solution because as the series progresses it reduces the number of attempts required to test and keeps the maximum attempts to 14 only.
It took some time for me to digest the optimal solution but finally it all made sense.
Winner: No one today.

No comments:

Post a Comment