Find Peak Element
Return the index of any peak element.
Examples
Input: [1,2,3,1]
Output: 2
Input: [1,2,1,3,5,6,4]
Output: 5
Hints
Use binary search to achieve O(log n) time complexity by comparing the middle element with its neighbors to determine the direction of the peak.
If the middle element is not a peak, move towards the side with the higher neighbor, as a peak must exist in that direction due to the problem's constraints.
Handle edge cases where the peak is at the boundaries (first or last element) by checking if the array is strictly increasing or decreasing before applying binary search.
Find Peak Element
Return the index of any peak element.