Skip to content

Commit d57d334

Browse files
committed
DaleStudy#231 Meeting Rooms
1 parent 51af125 commit d57d334

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

meeting-rooms/forest000014.java

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

0 commit comments

Comments
 (0)