Find a peak element in an array of integers.
A peak element is defined as a number whose both adjacent numbers are strictly lesser than the number.
For index 0 and n-1, i.e., 1st and last element, the left and right adjacent elements respectively, can be assumed as smaller than them everytime.
Example 1 - [1,2,3,3,3,4,1]
Answer - 4
Example 2 - [3,2,3,3,1]
Answer - 3 at index 0.
Follow Up - Solve it in log(N) complexity.