You are given a 0-indexed array
mountain
. Your task is to find all the peaks in themountain
array.Return an array that consists of indices of peaks in the given array in any order.
Notes:
- A peak is defined as an element that is strictly greater than its neighboring elements.
- The first and last elements of the array are not a peak.
1 | class Solution { |