We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7bcbedb commit ad3e83aCopy full SHA for ad3e83a
meeting-rooms/seungriyou.py
@@ -0,0 +1,23 @@
1
+# https://leetcode.com/problems/meeting-rooms/
2
+
3
+from typing import List
4
5
+class Solution:
6
+ def canAttendMeetings(self, intervals: List[List[int]]) -> bool:
7
+ """
8
+ [Complexity]
9
+ - TC: O(nlogn)
10
+ - SC: O(1) (inplace sorting)
11
12
+ [Approach]
13
+ intervals를 start 기준으로 오름차순 정렬 후, 앞 회의의 끝 시간 > 뒷 회의의 시작 시간이라면 겹치는 것이므로 False 반환
14
15
+ # sort intervals (by start)
16
+ intervals.sort()
17
18
+ for i in range(1, len(intervals)):
19
+ # prev_e > curr_s 라면 False
20
+ if intervals[i - 1][1] > intervals[i][0]:
21
+ return False
22
23
+ return True
0 commit comments