Peak Element
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
A peak element is an element that is strictly greater than its neighbors.
Given a -indexed integer array , find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks. You may imagine that . In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.
Input
The first line contains the size of array . The second line contains **n** integers . It is known that and also that for .
Output
Print the index of a peak element. If the array contains multiple peaks, return the index to any of the peaks.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 609
Acceptance rate 41%