首页
mac
it
登录
6mi
u
盘
搜
搜 索
it
169:众数
169:众数
mac
2022-06-30
24
注释:第三行用while比用if效率高
class
Solution
:
def
majorityElement
(
self
,
nums
:
List
[
int
]
)
-
>
int
:
for
i
in
set
(
nums
)
:
while
nums
.
count
(
i
)
>
len
(
nums
)
/
2
:
return
i
转载请注明原文地址: https://mac.8miu.com/read-68993.html
最新回复
(
0
)