Skip to content

Commit 0515c11

Browse files
committed
Time: 0 ms (100%), Space: 52.2 MB (16.67%) - LeetHub
1 parent 52e8340 commit 0515c11

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)