You are given a 0-indexed integer array nums.
A peak element is an element that is strictly greater than its immediate neighbors.
Your task is to find the index of any peak element in the array.
If multiple peaks exist, return the index of any one of them.
Assume that:
• nums[-1] = nums[n] = -∞ (virtual boundaries)
• You must design an algorithm that runs in O(log n) time complexity.
Input: nums = [2, 5, 3, 1]
Output: 1
Input: nums = [1, 4, 6, 3, 2, 7, 5]
Output: 2
Accepted:
Submission: