# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
#
# @param nums int整型一维数组
# @return int整型
#
class Solution:
def findPeakElement(self , nums: List[int]) -> int:
a=1
d=-2
if len(nums)==1:
return 0
if len(nums)==2:
if nums[0]>nums[1]:
return 0
else:
return 1
for i in range(len(nums)-2):
a1 = nums[i]
a2 = nums[i+a]
a3 = nums[i+2]
b1 = nums[-1-i]
b2 = nums[d-i]
b3 = nums[-3-i]
if a1<a2>a3 :
return i+a
if b1<b2>b3:
return len(nums)+d-i
if nums[len(nums)-1]==max(nums):
return len(nums)-1
else:
return 0
# write code here