Two eggs and a 100-storey building
product-puzzle case · difficulty 3/5 · 15 minutes · other
Prompt
You have two identical eggs and a 100-storey building. There is a highest floor from which an egg survives a drop. What is the smallest number of drops that guarantees you find that floor, in the worst case?
Context
A classic interview puzzle. Core idea: Minimizing the maximum number of drops using quadratic equations (x + (x-1) + ... = 100). Talk through your reasoning; the interviewer cares as much about structure as about the answer.
Clarifying questions
- Do eggs break on floor 1?
- Yes, an egg may break even from floor 1, or may survive all 100 floors. A surviving egg is as good as new and a broken egg cannot be used again.
Recommendation
**Answer:** 14 drops in the worst case. Drop the first egg from floors 14, 27, 39, 50, 60, 69, 77, 84, 90, 95, 99 and 100, and when it breaks, test upward with the second egg from the last safe floor. **Why:** Reducing each jump by one balances the worst case, because every drop of the first egg used up one of the allowed drops.
Risks
- Dropping from every 10th floor: the worst case is 10 + 9 = 19 drops
- Using binary search with the first egg: if it breaks at floor 50, the second must walk up to 49 floors
Next steps
- Solve for three eggs (answer: 9 drops)
- Solve for a 200-floor building with two eggs (answer: 20)