diff --git a/src/search.rs b/src/search.rs index 35c5a7d..b5be5c4 100644 --- a/src/search.rs +++ b/src/search.rs @@ -1,3 +1,4 @@ +/// Returns the smallest index on [l, r) satisfying the condition. pub fn lower_bound(range: std::ops::Range, prop: &dyn Fn(usize) -> bool) -> Option { if prop(range.start) { return Some(range.start); @@ -36,6 +37,7 @@ mod test_lower_bound { } } +/// Returns the largest index on [l, r) satisfying the condition. pub fn upper_bound(range: std::ops::Range, prop: &dyn Fn(usize) -> bool) -> Option { if !prop(range.start) { return None;