Tap here to switch tabs
Problem
Submissions

Problem: Find the Peaks

med
30 min
Try to solve the Find the Peaks problem.

Statement

You are given a 00 indexed integer array 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 mountain cannot be peaks.

Constraints:

  • 3≤3 \leq mountain.length ≤100\leq 100

  • 1≤1 \leq mountain[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Peaks

med
30 min
Try to solve the Find the Peaks problem.

Statement

You are given a 00 indexed integer array 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 mountain cannot be peaks.

Constraints:

  • 3≤3 \leq mountain.length ≤100\leq 100

  • 1≤1 \leq mountain[i] ≤100\leq 100