Hottest Value

In a cache, a "hot" value is the one that gets used most often. The function most_frequent receives a non-empty list items and returns the element with the highest number of occurrences. If several elements occur equally often, return the one that reaches that maximum count first.

Примеры

Ввод
[1, 2, 2, 3, 3, 3]
Вывод
3
Ввод
[5]
Вывод
5
Ввод
["a", "b", "a", "b", "a"]
Вывод
"a"

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

def most_frequent(items):

Теги

arraylistsdicthashmap
PostgreSQLv16

Тук ще се появи резултатът от изпълнението на кода

Visible tests
1
Input
[1,2,2,3,3,3]
Expected3
2
Input
[5]
Expected5
3
Input
["a","b","a","b","a"]
Expected"a"
4
Input
[1,1,2,2]
Expected1
5
Input
[7,7,7,1,1,1,7]
Expected7
6
Input
[2,3,3,4,4,4]
Expected4
Focus radio
Paused · SomaFM · Fluid