Overview
With unlimited eggs, binary search finds the critical floor in about 7 drops. With only two, you must balance the risk of each first-egg drop — a beautiful optimisation.
How to solve The Two-Egg Drop
- If the first egg breaks, the second must check every floor below linearly.
- So make each first-egg drop cover one fewer floor than the last: 14, then +13, +12, ….
- Choose the start so the decreasing steps still reach 100: 14+13+…+1 = 105 ≥ 100.
The key insight
Every drop should keep the worst case constant. As first-egg drops use up attempts, the floors each can cover must shrink by one — giving the triangular-number bound.
Variations & echoes
- The general k-egg, n-floor version is a classic dynamic-programming exercise.
- It models any test where trials are costly and 'specimens' are limited.
Frequently asked questions
Why not just binary search?
Binary search can break your first egg at floor 50, leaving 49 floors to test one by one with the last egg — up to 50 drops.