Thursday, December 14, 2017

2 eggs and a 100-storey building

You have two identical eggs and there is a 100-storey 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. You need to figure out the highest floor of the building from which an egg can be dropped without breaking. What strategy should be used to drop eggs such that total number of drops in worst case is minimized and we find the required floor. We may make following assumptions:
  • An egg that survives a fall can be used again but a broken egg must be discarded. 
  • If an egg breaks when dropped, then it would break if dropped from a higher floor. If an egg survives a fall then it would survive a shorter fall.

No comments: