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
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inVisible tests
1
Input
[3,3,2,1,3]Expected
22
Input
[1,1,1,1]Expected
03
Input
[1,2,3,4]Expected
34
Input
[5,5,5,2,2]Expected
25
Input
[7]Expected
06
Input
[4,3,2,1]Expected
3Focus radio
Paused · SomaFM · Fluid