852. Peak Index in a Mountain Array
用Q162的code,一点不改,都可以过...
162. Find Peak Elementclass Solution:
def peakIndexInMountainArray(self, A: List[int]) -> int:
for i in range(len(A)-1):
if A[i] > A[i+1]: return i
return len(A)-1
Last updated
Was this helpful?