有两种情况,要么存在要么不存在
class Solution: def MoreThanHalfNum_Solution(self, numbers): # write code here if len(numbers) == 1: return numbers[0] num = None for i in numbers: if i == num: return i num = i return 0
有两种情况,要么存在要么不存在
class Solution: def MoreThanHalfNum_Solution(self, numbers): # write code here if len(numbers) == 1: return numbers[0] num = None for i in numbers: if i == num: return i num = i return 0