标签:lse python3 def turn sel python element not etc
class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
freq = {}
for i in nums:
if i not in freq.keys():
freq[i] = 1
else:
freq[i] += 1
if freq[i] > len(nums)//2:
return i
标签:lse python3 def turn sel python element not etc
原文地址:https://www.cnblogs.com/theodoric008/p/9420376.html