All problems
Super Egg Drop
Problem
Given k eggs and n floors of identical critical height, return the minimum number of moves needed in the worst case to determine the highest safe floor.
With m moves and e eggs you can test C(m, 1) + ... + C(m, k) floors, so grow m until the coverage reaches n. Return 0 when n is 0.
Hint
The binomial term C(m, e) counts the floors that can be resolved with e eggs and m moves.
Test cases
case 1
in: [1,2]
expected: 2
case 2
in: [2,6]
expected: 3
case 3
in: [3,14]
expected: 4
case 4
in: [1,1]
expected: 1
case 5
in: [2,1]
expected: 1
case 6
in: [3,0]
expected: 0
Starter codePython
def super_egg_drop(k, n):
# Your code here
pass6 test cases · run your code against them in the editor