You are given a mountain.
An element is considered a peak if it is strictly greater than both its adjacent left and right neighbors.
Return an array containing the indices of all peaks in mountain in any order.
Note: The first and last elements of
mountaincannot be peaks.
Constraints:
mountain.length
mountain[i]
You are given a mountain.
An element is considered a peak if it is strictly greater than both its adjacent left and right neighbors.
Return an array containing the indices of all peaks in mountain in any order.
Note: The first and last elements of
mountaincannot be peaks.
Constraints:
mountain.length
mountain[i]