Frequency Leaders
Sometimes you need more than a frequency table — you need to know which values are tied for first place. Given a list arr, count how many times each value appears and return all values with the highest frequency. The returned list must be sorted in ascending order.
Примеры
Ввод
[[1, 1, 2, 2, 3]]Вывод
[1, 2]Ввод
[[1, 2, 3, 324, 234, 23, 23, 1, 23, 23]]Вывод
[23]Ввод
[[5]]Вывод
[5]Нужно реализовать
def top_1(arr: list[int]) -> list[int]:
Теги
arrayhashmap
Logga in för att se historik över inskick
Logga inLogga in för att använda AI-mentorn
Logga inVisible tests
1
Input
[1,1,2,2,3]Expected
[1,2]2
Input
[1,2,3,324,234,23,23,1,23,23]Expected
[23]3
Input
[5]Expected
[5]4
Input
[4,4,5,5]Expected
[4,5]5
Input
[1,2,3,324,234]Expected
[1,2,3,234,324]6
Input
[1]Expected
[1]Focus radio
Paused · SomaFM · Fluid