heights. A **summit** is a point strictly higher than both of its neighbours. The first and last points of the route never count as summits, since each has only one neighbour.
Return the indices of all summits (0-based) in any order.heights=[3, 7, 5, 6, 6, 2, 9] → [1]
Point 1 (height 7) is higher than both neighbours. Points 3 and 4 have equal height 6, so neither is strictly higher, and point 6 is an end point, which never counts.
heights=[9, 4, 1] → []
The only inner point is lower than its left neighbour.
heights=[1, 5, 1, 5, 1] → [1, 3]
heights=[3, 7, 5, 6, 6, 2, 9]
[1]
Run checks the first 3 tests in your browser. Submit checks all 116 tests on the server, hidden ones included.