class Solution:

# @param A : list of integers

# @return an integer

def perfectPeak(self, a):

n = len(a)

```
maxarr = [0] * n
minarr = [0] * n
maxarr[0] = a[0]
minarr[n - 1] = a[n - 1]
for i in range(1, n):
maxarr[i] = max(maxarr[i - 1], a[i])
for i in range(n - 2, -1, -1):
minarr[i] = min(minarr[i + 1], a[i])
for i in range(1, n - 1):
if maxarr[i] == minarr[i]:
return 1
return 0
```