dynamic_programming.egg_dropping

Calculate the minimum number of attempts needed in the worst case to find the critical floor from which eggs start breaking when dropped.

Attributes

input_data

Functions

egg_dropping(→ int)

Calculate the minimum number of attempts needed in the worst case for eggs

Module Contents

dynamic_programming.egg_dropping.egg_dropping(eggs: int, floors: int) int

Calculate the minimum number of attempts needed in the worst case for eggs and floors using dynamic programming.

>>> egg_dropping(1, 5)
5
>>> egg_dropping(2, 6)
3
>>> egg_dropping(2, 10)
4
dynamic_programming.egg_dropping.input_data