0169. 多数元素 #35
utterances-bot
started this conversation in
Comments
Replies: 2 comments 1 reply
-
max = 0
max_index = -1
for num in numDict:
if numDict[num] > max:
max = numDict[num]
max_index = num
return max_index not working when nums all smaller than 0, just use |
Beta Was this translation helpful? Give feedback.
0 replies
-
已更新初始化 max 为 float('-inf') |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
0169. 多数元素 | 算法通关手册
https://algo.itcharge.cn/Solutions/0100-0199/majority-element/
Beta Was this translation helpful? Give feedback.
All reactions