go_binary
go 语言二分查找
1. lower_bound
在nums中查找第一个大于等于target的位置
1 | func lower_bound(nums []int, target int) int { |
2. upper_bound
在nums中查找第一个大于target的位置
1 | func upper_bound(nums []int, target int) int { |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.