def equalizeArray(arr):
# Write your code herepopo
num_dict = {}
for i in arr:
if num_dict.get(i):
num_dict[i] += 1
else:
num_dict[i] = 1
key_value = sorted(num_dict.items(), key = lambda x: x[1], reverse = True)[0][0]
k_num = arr.count(key_value)
return len(arr) - k_num
'# 코딩 문제 관련 > 파이썬' 카테고리의 다른 글
[HackerRank - python] ACM ICPC Team (0) | 2022.09.07 |
---|---|
[HackerRank-python] Queen's Attack Ⅱ (0) | 2022.08.29 |
Jumping on the Clouds (0) | 2022.08.23 |
[HackerRank-python] Repeated String (0) | 2022.08.22 |
[HackerRank-python] Non-Divisible Subset (0) | 2022.08.14 |