松鼠霖
松鼠霖
全部文章
题解
归档
标签
去牛客网
登录
/
注册
松鼠霖的博客
全部文章
/ 题解
(共3篇)
题解 | #数组中只出现一次的两个数字#
遇到这种要看重不重复的,第一反应就是会想到用dict去判断 class Solution: def FindNumsAppearOnce(self , array ): # write code her...
哈希
字典
2021-09-07
0
324
题解 | #数组中重复的数字#
按照第一想法来就行了,建立一个dict用来保存数字是否重复,然后返回重复的数字即可 # # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param numbers int整型一维数组 # @return int...
哈希
字典
2021-08-31
0
354
题解 | #数组中出现次数超过一半的数字#
第一反应就是想到new一个dictionary出来,用key和value来保存number和对应的次数 # -*- coding:utf-8 -*- class Solution: def MoreThanHalfNum_Solution(self, numbers):...
栈
sort()
字典
哈希
2021-08-29
0
361