You are in a building with n floors and you have two identical eggs. You need to find the threshold floor F, which is the highest floor from which an egg will not break when dropped. We can assume 0 <= F <= n.
The properties of the eggs are:
x, it will also break when dropped from any floor higher than x.x, it will also survive a fall from any floor lower than x.Your task is to determine the minimum number of drops required to find the threshold floor F in the worst-case scenario.
10
4
With 10 floors, the optimal strategy is to drop the first egg from floor 4.
100
14
For a 100-story building, the minimum number of drops required in the worst case is 14.
2
2
With 2 floors, you drop from floor 1. If it breaks, F=0 (1 drop). If it survives, you drop from floor 2. If it breaks, F=1. If it survives, F=2. The worst case is 2 drops.
10
4