File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 220
220
| 249 | π [Group Shifted Strings](https://leetcode.com/problems/group-shifted-strings) | | |
221
221
| 250 | π [Count Univalue Subtrees](https://leetcode.com/problems/count-univalue-subtrees) | | |
222
222
| 251 | π [Flatten 2D Vector](https://leetcode.com/problems/flatten-2d-vector) | | |
223
- | 252 | π [Meeting Rooms](https://leetcode.com/problems/meeting-rooms) | | |
223
+ | 252 | π [Meeting Rooms](https://leetcode.com/problems/meeting-rooms) | [](src/MeetingRooms.java) | |
224
224
| 253 | π [Meeting Rooms II](https://leetcode.com/problems/meeting-rooms-ii) | | |
225
225
| 254 | π [Factor Combinations](https://leetcode.com/problems/factor-combinations) | | |
226
226
| 255 | π [Verify Preorder Sequence In Binary Search Tree](https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree) | | |
Original file line number Diff line number Diff line change
1
+ // https://leetcode.com/problems/meeting-rooms
2
+ // T: O(N logN)
3
+ // S: O(logN)
4
+
5
+ import java .util .Arrays ;
6
+ import java .util .Comparator ;
7
+
8
+ public class MeetingRooms {
9
+ public boolean canAttendMeetings (int [][] intervals ) {
10
+ Arrays .sort (intervals , Comparator .comparingInt (a -> a [0 ]));
11
+ for (int i = 0 ; i < intervals .length - 1 ; i ++) {
12
+ if (intervals [i ][1 ] > intervals [i + 1 ][0 ]) {
13
+ return false ;
14
+ }
15
+ }
16
+ return true ;
17
+ }
18
+ }
You canβt perform that action at this time.
0 commit comments