1class Solution:2def superEggDrop(self, e: int, f: int) -> int:3dp = [[-1 for _ in range(e + 1)] for _ in range(f + 1)]45def solve(floors, eggs):67if eggs == 1:8dp[floors][eggs] = floors9return floors1011if floors == 0:12dp[floors][eggs] = 013return 01415if dp[floors][eggs] == -1:1617ans = math.inf18low = 119high = floors20# Binary Search for the floor where to drop the egg21while low <= high:22mid = (low + high) // 223left = solve(mid - 1, eggs - 1)24right = solve(floors - mid, eggs)25tmp = 1 + max(left, right)26if left < right:27low = mid + 128else:29high = mid - 130ans = min(ans, tmp)3132dp[floors][eggs] = ans3334return dp[floors][eggs]3536return solve(f, e)