Find the Peak
The array strictly increases to a single peak and then strictly decreases (either side may be empty). Print the 1-based index of the peak.
Input: the first line has N; the second line has the mountain array.
Output: the peak's position.
Constraints:
- 1 ≤ N ≤ 105
Sample Tests
Input 1
5 1 3 5 4 2
Output 1
3
Input 2
3 3 2 1
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.