Clear the Highest Hurdle
A runner faces a track of hurdles and can jump over anything up to their current limit. The function hurdle_race receives the jump height k and a list of hurdle heights height. Each potion dose increases the maximum jump by 1. Return the minimum number of doses needed to clear the tallest hurdle.
Примеры
Ввод
7, [2, 5, 4, 5, 2]Вывод
0Ввод
4, [1, 6, 3, 5, 2]Вывод
2Ввод
1, [1]Вывод
0Нужно реализовать
def hurdle_race(k: int, height: list[int]) -> int:
Теги
arraymath
Logi sisse, et näha esituste ajalugu
Logi sisseLogi sisse, et kasutada AI mentorit
Logi sisseTests12
Visible tests
Peidetud test 7
Peidetud test 8
Peidetud test 9
Peidetud test 10
Peidetud test 11
Peidetud test 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid