Record Breaks

In sports stats, it is useful to track not only the final score, but also the moments when a player beats their best or drops below their previous worst. The function breaking_records receives a list scores with game results in order. The first game sets the starting records and does not count as a break. Return [max_count, min_count]: how many times the highest record was broken and how many times the lowest record was broken.

Примеры

Ввод
[10, 5, 20, 20, 4, 5, 2, 25, 1]
Вывод
[2, 4]
Ввод
[3, 4, 21, 36, 10, 28, 35, 5, 24, 42]
Вывод
[4, 0]
Ввод
[5]
Вывод
[0, 0]

Нужно реализовать

def breaking_records(scores: list[int]) -> list[int]:

Теги

arraymath
PostgreSQLv16

Tutaj pojawi się wynik wykonania kodu

Visible tests
1
Input
[10,5,20,20,4,5,2,25,1]
Expected[2,4]
2
Input
[3,4,21,36,10,28,35,5,24,42]
Expected[4,0]
3
Input
[5]
Expected[0,0]
4
Input
[1,2,3,4,5]
Expected[4,0]
5
Input
[5,4,3,2,1]
Expected[0,4]
6
Input
[5,5]
Expected[0,0]
Focus radio
Paused · SomaFM · Fluid