822. Super Egg Drop (Binary Search + Recursion)

HardRecursionRecursion

Same as Egg Drop but with higher constraints. Given k eggs and n floors, return the minimum number of moves (worst case) to find the critical floor.

Input: Two integers k, n.

Output: Integer.

Examples

Example 1
Input: 1, 2
Output: 2
Explanation: Try floor 1, then 2.
Example 2
Input: 2, 6
Output: 3
Explanation: 3 moves suffice.
Example 3
Input: 3, 14
Output: 4
Explanation: 4 moves with 3 eggs.

Constraints

Asked by

GoogleMicrosoftBloombergAmazon
Solve this problem in the editor →