Super Egg Drop
Problem Description
You have k eggs and n floors. Find the minimum number of moves to determine the critical floor (highest floor from which an egg won't break).
Rules: A broken egg is lost. An unbroken egg can be reused. You may assume floor 0 always safe.
Example 1: k=1, n=2 → 2
Example 2: k=2, n=6 → 3
Example 3: k=3, n=14 → 4
DE Shaw Tier 1 — LC 887.
Naive DP: dp[k][n] = 1 + min over floor f of max(dp[k-1][f-1], dp[k][n-f]). O(kn^2).
Optimal: Reframe — dp[m][k] = max floors checkable with m moves and k eggs. dp[m][k] = dp[m-1][k-1] + dp[m-1][k] + 1. Find smallest m where dp[m][k] >= n. O(k log n).
Example Test Cases
Example 1
Input: [1,2]
Expected: 2
Example 2
Input: [2,6]
Expected: 3
Example 3
Input: [3,14]
Expected: 4
Example 4
Input: [2,100]
Expected: 14
Run your code to see the results