Skip to content

Commit 0315a1a

Browse files
committed
solve metting rooms
1 parent b4737e0 commit 0315a1a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

meeting-rooms/sora0319.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import java.util.*;
2+
3+
public class Solution {
4+
public boolean canAttendMeetings(int[][] intervals) {
5+
Arrays.sort(intervals, (a, b) -> Integer.compare(a[0], b[0]));
6+
7+
for (int i = 0; i < intervals.length - 1; i++) {
8+
if (intervals[i][1] > intervals[i + 1][0]) {
9+
return false;
10+
}
11+
}
12+
return true;
13+
}
14+
}

0 commit comments

Comments
 (0)