class Solution(object):
def findPeakElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return -1
for i in range(len(nums)):
if i+1<len(nums) and nums[i]>nums[i+1]:
return i
return len(nums)-1
python leetcode 162. Find Peak Element
猜你喜欢
转载自blog.csdn.net/Neekity/article/details/84998777
今日推荐
周排行