Two Eggs, 100 Floors
You have two identical eggs and a 100-story building. There exists some floor such that:
- An egg dropped from floor or below survives.
- An egg dropped from any floor above breaks.
You want to find . Eggs that survive a drop can be reused; broken eggs are gone forever. What's the minimum number of drops you need in the worst case to guarantee finding ?
Binary search. Drop from floor 50. If it survives, try floor 75. If not, try 25. And so on.
With unlimited eggs, this gives you drops. Tidy. But you don't have unlimited eggs.
You have two. If your first drop from floor 50 breaks, your one remaining egg can no longer afford to be wrong — a second break loses your last egg before you've pinned down . You're forced to scan linearly from floor 1 upward, one drop per floor. Worst case: 50 drops.
Binary search is the right tool for the wrong constraint.