Every drop of the first egg spends one of your drops, so each gap should be one floor shorter than the last: 14, 27, 39, and so on. Flip the question to "how many floors can d drops cover?" and the same idea solves any number of eggs.
You have two identical eggs and a building with 100 floors. There's some floor at or below which an egg survives a drop, and above which it breaks ( can be 0, if every drop breaks it, or 100, if none do). An egg that survives can be dropped again. A broken one is gone.
What's the fewest drops that guarantees you find , however unlucky you are?
"However unlucky" is the whole problem. You're not minimizing the average, you're minimizing the worst case, and the adversary picks after seeing your strategy.
Why the obvious strategies lose
With one egg there's only one safe strategy: start at floor 1 and go up one at a time. The first break tells you . Skip a floor and a break leaves you unable to tell which of the two floors did it. So one egg costs up to 100 drops.
The second egg is what buys you speed: you can use the first one to take big jumps, and fall back to the careful floor-by-floor walk with the second once the first breaks.
| Strategy for the first egg | Drops at | Worst case |
|---|---|---|
| None (one egg, walk up) | 1, 2, 3, ... | 100 |
| Binary search | 50, then 75 if it survives | 50 |
| Fixed steps of 10 | 10, 20, ..., 100 | 19 |
| Shrinking steps | 14, 27, 39, 50, ... | 14 |
Binary search is the instinct, and it's the worst of the jumping strategies. Drop at 50 and it breaks: you have one egg left and 49 floors below, which is 49 more drops, one at a time. Binary search assumes a failed probe is cheap. Here the first failure costs you half your tools.
Steps of 10 do much better. The worst case is when the first egg survives nine times and breaks at 100: that's 10 drops, then 9 more walking 91 to 99. But notice the imbalance. If it breaks on the very first drop, at 10, you only need 9 more: 10 total. Fixed steps make late breaks expensive and early breaks cheap. The worst case is set by the expensive end.
Balance the worst case
Every time the first egg survives, you've spent a drop. So the next gap should be one floor shorter, to keep the total the same whichever drop it breaks on.
Say the answer is drops. The first drop goes at floor : if it breaks, the second egg walks floors 1 to , drops total. If it survives, you have drops left, so the next drop goes floors higher, then , and so on down to 1. The floors you can cover add up to
(1) Floors covered with d drops and two eggs must reach n.
For : falls short, clears it. So 14 drops, with the first egg going at 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99 and 100.
Check it at a couple of points. Break at 14: walk 1 to 13, that's . Break at 27: walk 15 to 26, that's . Every break costs the same total. That's what balanced means.
It's also a proof that 13 can't work. With 13 drops the first one has to be at floor 13 or lower (a break there leaves 12 drops for the floors below). The next can be at most 12 floors higher, and so on. The furthest you can reach is , and a building with 100 floors has nine you'd never test.
Flip the question
"Fewest drops for floors" is awkward to compute directly. The inverse is easy: with drops and eggs, how many floors can you fully cover? Call it .
Make one drop, from some floor. Either the egg breaks, and you have drops and eggs for the floors below; or it survives, and you have drops and eggs for the floors above. Plus the floor you just tested:
(2) Floors coverable with d drops and k eggs.
with (no drops, no floors) and (no eggs, no floors).
With one egg, : the walk up. With two, the recurrence gives , which unrolls to , exactly equation (1). The general answer is a sum of binomial coefficients:
(3) Closed form for any number of eggs.
It follows from equation (2) by Pascal's rule, , with the supplying the term.
Give yourself as many eggs as drops () and equation (3) becomes .
The algorithm
- 1
Keep
covered[k], the floors checkable with the drops so far and eggs. - 2
Add one drop and update every
covered[k]with equation (2). - 3
Stop as soon as
covered[eggs]reaches the number of floors.
For two eggs specifically you can skip the loop and solve equation (1) for directly: , which for is .
Complexity
d rounds of k updates, where d is the answer: about √(2n) for two eggs, about log₂ n once eggs are plentiful.
One running count per egg.
With two eggs that's time and constant space.
Common pitfalls
- 1
Reaching for binary search
It's optimal only when a failed probe costs nothing. With two eggs, the first break drops you to a linear walk, and binary search's first probe puts that walk at half the building.
- 2
Stopping at fixed √n steps
Steps of give about drops, 19 for 100 floors. Shrinking the step by one each time gets , 14. Same idea, about a quarter fewer drops.
- 3
The textbook DP over floors
The direct recurrence tries every floor for the next drop and takes . It's correct and , too slow for Super Egg Drop's . Flipping to "floors per drop count" is what makes it fast.
- 4
Minimizing the average
The question is the guaranteed bound. A strategy that's usually quick but occasionally needs 20 drops loses to one that always needs 14.

