Super Egg Drop

Hard

Topics
MathBinary SearchDynamic Programming

You are given a identical eggs and access to a building with b floors. An egg breaks if dropped from a floor at or above some unknown threshold f (0 <= f <= b) and survives below it. Return the minimum number of moves needed to determine f with certainty in the worst case.

Example 1

Input:  a = 1, b = 2
Output: 2

Example 2

Input:  a = 2, b = 6
Output: 3

Example 3

Input:  a = 3, b = 14
Output: 4

Constraints

  • 1 <= a <= 100
  • 1 <= b <= 10^4
Run ⌘' · Submit ⌘⏎