-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution3285.go
More file actions
27 lines (23 loc) · 793 Bytes
/
Copy pathsolution3285.go
File metadata and controls
27 lines (23 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package solution3285
// ============================================================================
// 3285. Find Indices of Stable Mountains
// URL: https://leetcode.com/problems/find-indices-of-stable-mountains/
// ============================================================================
/*
goos: linux
goarch: amd64
pkg: GoLeetCode/solutions/3285--Find-Indices-of-Stable-Mountains
cpu: 13th Gen Intel(R) Core(TM) i7-13700K
Benchmark_StableMountains
Benchmark_StableMountains-24 46737021 22.68 ns/op 48 B/op 1 allocs/op
PASS
*/
func stableMountains(height []int, threshold int) []int {
indices := make([]int, 0, len(height))
for i := 1; i < len(height); i++ {
if height[i-1] > threshold {
indices = append(indices, i)
}
}
return indices
}