Skip to interview prep
Apexed
Problem list125 / 125

125. Egg Dropping: Minimum Trials

HardDynamic programming

A building has floors 1 to floors. There is a threshold floor f (0 ≤ f ≤ floors): an egg dropped from above f breaks, and one dropped from f or below survives and can be reused. You have eggs identical eggs.

Return the minimum number of drops that guarantees finding f in the worst case.

Example 1

Input: eggs = 1, floors = 10
Output: 10

Example 2

Input: eggs = 2, floors = 100
Output: 14

Constraints

  • 1 ≤ eggs ≤ 100
  • 1 ≤ floors ≤ 10⁴

Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor

Run checks these cases; the expected output comes from the reference solution. Submit judges all 5 hidden and sample tests.

Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.

Egg Dropping: Minimum Trials — coding interview practice — Apexed