摘要: 自己写的: class Solution: def majorityElement(self, nums): # 创建一个空字典用于存储数字和其出现次数 mydict = dict() # 遍历输入的列表 nums for i in nums: # 如果数字 i 不在字典中,将其添加到字典,并初始化 阅读全文
posted @ 2024-03-04 10:09 Junior_bond 阅读(6) 评论(0) 推荐(0)