时间复杂度:O(n)

class Solution:
    def MoreThanHalfNum_Solution(self, numbers):
        # write code here
        if not numbers:
            return 0
        res = numbers[0]
        times = 0
        for i in numbers:
            if i == res:
                times += 1
            if i != res:
                if times > 0:
                    times -= 1
                else:
                    res = i
                    times = 1
        if self.Check(numbers,res):return res
        else:return 0
    def Check(self, numbers, res):
        n = 0
        for i in numbers:
            if i == res:
                n += 1
        return n > len(numbers)/2