class Solution(object):
def peakIndexInMountainArray(self, A):
"""
:type A: List[int]
:rtype: int
"""
start = 1
end = len(A) - 2
while(start + 1 < end):
mid = start + (end - start) // 2
if A[mid-1] <= A[mid] <= A[mid+1]:
start = mid
elif A[mid+1] <= A[mid] <= A[mid-1]:
end = mid
else:
return mid
if A[start] < A[end]:
return end
else:
return start