Valid Mountain Array

Medium · rating 1300 · Arrays

The first line has n. The second line has n integers. Print YES if the array strictly increases to a single peak and then strictly decreases (the peak is neither the first nor last element), otherwise NO.

Constraints: 1 ≤ n ≤ 105

Related problems

Open Valid Mountain Array in Code Arena →