leetcode 给定一个大小为 n 的数组,找到其中的众数(python)
leetcode 给定一个大小为 n 的数组,找到其中的众数(python)
小白探索之路,记录自己的代码,并希望对你有所帮助
语言:python
class Solution:
def majorityElement(self, nums: List[int]) -> int:
se=set(nums)
a=0
c=0
for i in se:
b=nums.count(i)
if a&...
原创
2019-05-13 16:29:36 ·
690 阅读 ·
0 评论