Python Solution: O(n) Time, O(n) Space


#1
def perfectPeak(self, A):
    left, right, min_so_far, max_so_far = [], [], len(A)-1, 0
    for peak in range(1, len(A)-1):
        if A[peak] > A[max_so_far]:
            left.append(peak)
            max_so_far = peak
    for peak in range(len(A)-2, 0, -1):
        if A[peak] < A[min_so_far]:
            right.append(peak)
            min_so_far = peak
    return 0 if set(left).intersection(set(right)) == set() else 1