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