We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b7091bd + 68479ac commit 34790f3Copy full SHA for 34790f3
src/search.rs
@@ -1,3 +1,4 @@
1
+/// Returns the smallest index on [l, r) satisfying the condition.
2
pub fn lower_bound(range: std::ops::Range<usize>, prop: &dyn Fn(usize) -> bool) -> Option<usize> {
3
if prop(range.start) {
4
return Some(range.start);
@@ -36,6 +37,7 @@ mod test_lower_bound {
36
37
}
38
39
40
+/// Returns the largest index on [l, r) satisfying the condition.
41
pub fn upper_bound(range: std::ops::Range<usize>, prop: &dyn Fn(usize) -> bool) -> Option<usize> {
42
if !prop(range.start) {
43
return None;
0 commit comments