# -*-coding:utf-8-*-
class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
a = {}
for i in nums:
if str(i) in a.keys():
a[str(i)] += 1
else:
a[str(i)] = 1
a = sorted(a.items(), key = lambda c: c[1])
return int(a[len(a) - 1][0])
sorted的排列很好用