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

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

编程技巧