Peak_element

easy
Given an array of integers A,find and return the peak element in it.An element is peak if it is not smaller than its neighbors.For the corner elements,we need to consider only one neighbor.It is assured that the answer will be unique.

Input Format

Size of Array N. N elements of the array

Output Format

The peak of an element

Constraints

1<=[A]<=100000
1<=A[i]<=10^9

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
4
1
2
3
1
Output
3
Previous
Divisor_game
Next
Confused Robber

Related Questions