Design The Two Egg Problem (famous problem) Extend to when n=3 , 4 ,5 and floors 100 where n is no.of eggs given


  • 1
    S

    You are given two eggs, and access to a 100-storey building. Both eggs are identical. The aim is to find out the highest floor from which an egg will not break when dropped out of a window from that floor. If an egg is dropped and does not break, it is undamaged and can be dropped again. However, once an egg is broken, that’s it for that egg.

    If an egg breaks when dropped from floor n, then it would also have broken from any floor above that. If an egg survives a fall, then it will survive any fall shorter than that.

    The question is: What strategy should you adopt to minimize the number egg drops it takes to find the solution?. (And what is the worst case for the number of drops it will take?)


  • 2

    Egg dropping puzzle, we can use DP to solve it, for solution details, take a look at this article:
    http://www.geeksforgeeks.org/dynamic-programming-set-11-egg-dropping-puzzle/


  • 2
    P

    This article has the optimal solution for the general case: https://brilliant.org/wiki/egg-dropping/


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.