Best High Scores

A leaderboard usually shows only the strongest results, not every score ever recorded. The function personal_top_three receives a list scores and returns the three highest scores in descending order. If there are fewer than three scores, return all available scores in the correct order.

Примеры

Ввод
[10, 30, 90, 30, 100]
Вывод
[100, 90, 30]
Ввод
[20, 10]
Вывод
[20, 10]
Ввод
[30, 70]
Вывод
[70, 30]

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

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

Теги

listssorting
PostgreSQLv16

Hier verschijnt het resultaat van je code

Visible tests
1
Input
[10,30,90,30,100]
Expected[100,90,30]
2
Input
[20,10]
Expected[20,10]
3
Input
[30,70]
Expected[70,30]
4
Input
[40]
Expected[40]
5
Input
[10,30,40,20]
Expected[40,30,20]
6
Input
[]
Expected[]
Focus radio
Paused · SomaFM · Fluid