数组中出现次数超过一半的数字 2015/12/02 16978 # -*- coding:utf-8 -*- class Solution: def MoreThanHalfNum_Solution(self, numbers): nlist = set(numbers) nlen = len(numbers) for item in nlist: if numbers.count(item) > (nlen/2.0): return item else: return 0