숫자로 이루어진 배열인 nums를 인자로 전달합니다.
숫자중에서 과반수(majority, more than a half)가 넘은 숫자를 반환해주세요.
def more_than_half(nums):
# 아래 코드를 입력해주세요.
dic = {}
for n in nums:
if n not in dic:
dic[n] = 1
else:
dic[n] += 1
dic_max = max(dic, key=dic.get)
return dic_max
more_than_half([2,2,1,1,1,2])