Number of Flowers in Full Bloom LeetCode solution in Rust

1
impl Solution {
2
pub fn full_bloom_flowers(flowers: Vec<Vec<i32>>, people: Vec<i32>) -> Vec<i32> {
3
let get_time_and_sort = |i| {
4
let mut ret = flowers.iter().map(|f| f[i]).collect::<Vec<_>>();
5
ret.sort();
6
ret
7
};
8
let start = get_time_and_sort(0);
9
let end = get_time_and_sort(1);
10

11
people
12
.into_iter()
13
.map(|time| {
14
(start.partition_point(|&s| s <= time) - end.partition_point(|&e| e < time)) as i32
15
})
16
.collect()
17
}
18
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0