题解 | #寻找峰值#
寻找峰值
http://www.nowcoder.com/practice/fcf87540c4f347bcb4cf720b5b350c76
直接查找
class Solution:
def findPeakElement(self , nums: List[int]) -> int:
# write code here
l = len(nums)
index = 0
for i in range(1, l):
if nums[i] > nums[i-1]:
index = i
return index