#C442. Peak Element Finder
Peak Element Finder
Peak Element Finder
Given an array of integers, your task is to find the index of any one peak element. An element ai is considered a peak if it is not smaller than its neighbors. For the extreme elements (first and last) of the array, only one neighboring element is considered. Formally, for any valid index i, a peak satisfies:
$$ a_i \geq a_{i-1} \quad \text{(if } i>0 \text{)} \quad \text{and} \quad a_i \geq a_{i+1} \quad \text{(if } i<n-1 \text{)}.$$
If there are multiple peaks, returning any one of them is acceptable.
inputFormat
The input is read from stdin and consists of two lines. The first line contains a single integer n (1 ≤ n ≤ 100,000), which denotes the number of elements in the array. The second line contains n space-separated integers representing the array elements.
outputFormat
Output a single integer to stdout — the index of any one peak element found in the array.
## sample1
10
0
</p>