class Solution:
def dominantIndex(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
max_num = max(nums)
for num in nums:
if 2*num > max_num and num != max_num:
return -1
return nums.index(max_num)
leetcode 747. Largest Number At Least Twice of Others 至少是其他数字两倍的最大数 python list.remove()没有返回值
猜你喜欢
转载自blog.csdn.net/huhehaotechangsha/article/details/80928990
今日推荐
周排行