Data Structures & AlgorithmsVery hardProduct Company SDE · ICPC regional

Problem: The egg-dropping puzzle with 2 eggs and a 10-floor building: what is the minimum number of drops needed in the worst case to find the highest safe floor (or prove none is safe)?

  1. A. 5
  2. B. 3
  3. C. 6
  4. D. 4

Correct answer: D. 4

The worst-case DP splits floors so that a breaking egg leaves a bounded search. With two eggs, the optimal first drop skips floors, so a linear scan from floor 1 is too slow.

More Coding Interview Problems questions

Exams that ask this topic