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. The array may contain multiple peaks; in that case, return the index to any of the peaks. You may imagine that `nums[-1] = nums[n] = -∞`.
{
"nums": [
1,
2,
3,
1
]
}2{
"nums": [
1,
2,
1,
3,
5,
6,
4
]
}5{
"nums": [
1
]
}0Sign in to Run Code and Submit