A peak element is an element that is strictly greater than its neighbors. Given an array of integers, find a peak element and return its index.
Example 1:
Input:
nums = [1,2,3,1]
Output:
2
All DSA practice problems · DSA mock interview · Mock interviews by company and role · Book a 1:1 interview