#252
Easy Algorithms Meeting rooms
Array Sorting
59.4% acceptance
Mar 31, 2026
2122
117
Given an array of meeting time intervals where intervals[i] = [starti, endi], determine if a person could attend all meetings.
Solution
Rust
Time O(1)
Space O(1)
impl Solution {
pub fn can_attend_meetings(mut intervals: Vec<Vec<i32>>) -> bool {
intervals.sort_unstable_by_key(|i| i[0]);
intervals.windows(2).all(|w| w[0][1] <= w[1][0])
}
}