We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c82043e commit 371ad32Copy full SHA for 371ad32
drafts/helpers.go
@@ -33,11 +33,11 @@ func Abs[T ordered](x, y T) T {
33
return x - y
34
}
35
36
-func LowerBound[T any](arr []T, x T, func less(x, y T) bool) {
+func LowerBound[T any](arr []T, x T, less func (T, T) bool) int {
37
return sort.Search(len(arr), func (i int) bool { return less(x, arr[i]) })
38
39
40
-func UpperBound[T any](arr []T, func less(x, y T) bool) {
+func UpperBound[T any](arr []T, x T, less func (T, T) bool) int {
41
return sort.Search(len(arr), func (i int) bool {
42
if i == len(arr) - 1 {
43
return len(arr)
0 commit comments