## 252. Meeting Rooms

Given an array of meeting time `intervals` where `intervals[i] = [starti, endi]`, determine if a person could attend all meetings.

Example 1:

```Input: intervals = [[0,30],[5,10],[15,20]]
Output: false
```

Example 2:

```Input: intervals = [[7,10],[2,4]]
Output: true
```

Constraints:

• `0 <= intervals.length <= 104`
• `intervals[i].length == 2`
• `0 <= starti < endi <= 106`

## Rust Solution

``````struct Solution;

impl Solution {
fn can_attend_meetings(mut intervals: Vec<Vec<i32>>) -> bool {
intervals.sort_by(|a, b| a[0].cmp(&b[0]));
for i in 1..intervals.len() {
if intervals[i][0] < intervals[i - 1][1] {
return false;
}
}
true
}
}

#[test]
fn test() {
let intervals = vec![vec![0, 30], vec![5, 10], vec![15, 20]];
assert_eq!(Solution::can_attend_meetings(intervals), false);
let intervals = vec![vec![7, 10], vec![2, 4]];
assert_eq!(Solution::can_attend_meetings(intervals), true);
}
``````

Having problems with this solution? Click here to submit an issue on github.