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
PostgreSQLv16

Itt jelenik meg a kód futtatásának eredménye

Visible tests
1
Input
7, [2,5,4,5,2]
Expected0
2
Input
4, [1,6,3,5,2]
Expected2
3
Input
1, [1]
Expected0
4
Input
0, [5]
Expected5
5
Input
10, [10,10,10]
Expected0
6
Input
-4, [1,6,3,5,2]
Expected10
Focus radio
Paused · SomaFM · Fluid