...

/

Challenge: Peak Element

Challenge: Peak Element

In this lesson, you will find the peak element in a given array. The peak element is the element that is greater than both of its neighbors.

Peak element

"A peak element in an array is the element which is always greater than or equal to its neighbors."

For example, consider the following array:

In case the peak element is at the end of an array, we only consider its single neighbor.

Note that we need to return ...