We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 52e8340 commit 0515c11Copy full SHA for 0515c11
3221-find-the-peaks/3221-find-the-peaks.js
@@ -0,0 +1,11 @@
1
+/**
2
+ * @param {number[]} mountain
3
+ * @return {number[]}
4
+ */
5
+var findPeaks = function(mountain) {
6
+ let res = [];
7
+ for (let i = 1; i < mountain.length-1; i++) {
8
+ if (mountain[i-1] < mountain[i] && mountain[i] > mountain[i+1]) res.push(i)
9
+ }
10
+ return res;
11
+};
0 commit comments