Two Eggs, 100 Floors

The problem
100 floorsegg 1egg 2find the threshold k

You have two identical eggs and a 100-story building. There exists some floor kk such that:

  • An egg dropped from floor kk or below survives.
  • An egg dropped from any floor above kk breaks.

You want to find kk. 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 kk?

Tempting (but wrong)
drop 1 @ 50egg 1 breaksnow linear 1→49binary search → worst case 50 drops

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 log2100=7\lceil \log_2 100 \rceil = 7 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 kk. 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.