Make Values Equal

Sometimes you need to clean up a list so that only one repeated value remains. The function equalize_array receives a list of integers arr. In one operation, you may delete one element. Return the minimum number of deletions needed so that all remaining elements are equal.

Примеры

Ввод
[3, 3, 2, 1, 3]
Вывод
2
Ввод
[1, 1, 1, 1]
Вывод
0
Ввод
[1, 2, 3, 4]
Вывод
3

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

def equalize_array(arr: list[int]) -> int:

Теги

arraydicthashmap
PostgreSQLv16

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

Visible tests
1
Input
[3,3,2,1,3]
Expected2
2
Input
[1,1,1,1]
Expected0
3
Input
[1,2,3,4]
Expected3
4
Input
[5,5,5,2,2]
Expected2
5
Input
[7]
Expected0
6
Input
[4,3,2,1]
Expected3
Focus radio
Paused · SomaFM · Fluid