https://leetcode.com/problems/majority-element/
import math
class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
mydict = {}
for x in nums:
if x in mydict:
mydict[x] += 1
else:
mydict[x] = 1
target = math.ceil(float(len(nums))/2)
for k,v in mydict.items():
if v >= target:
return k