-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution3065.go
More file actions
34 lines (26 loc) · 751 Bytes
/
solution3065.go
File metadata and controls
34 lines (26 loc) · 751 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
28
29
30
31
32
33
34
package solution3065
import "slices"
// ============================================================================
// 3065. Minimum Operations to Exceed Threshold Value I
// URL: https://leetcode.com/problems/minimum-operations-to-exceed-threshold-value-i/
// ============================================================================
/*
goos: linux
goarch: amd64
pkg: GoLeetCode/solutions/3065
cpu: 13th Gen Intel(R) Core(TM) i7-13700K
Benchmark_minOperations
Benchmark_minOperations-24 120689896 9.693 ns/op 0 B/op 0 allocs/op
PASS
*/
func minOperations(nums []int, k int) int {
slices.Sort(nums)
var ops int
for i := 0; i < len(nums); i++ {
if nums[i] >= k {
break
}
ops++
}
return ops
}