数组中出现次数超过一半的数字

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

# -*- 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