pub fn find_interval<P>(size: i32, pred: P) -> i32 where P: Fn(i32) -> bool,
Helper function which emulates the behavior of std::upper_bound().