A peak element is an element that is strictly greater than its neighbors.
Given an integer array
nums, 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
nums[-1] = nums[n] = -∞.
Input: nums = [1,2,3,1]
Explanation: 3 is a peak element and your function should return the index number 2.
Input: nums =…