File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ from typing import List
2+
3+
4+ class Solution :
5+ def canAttendMeetings (self , intervals : List [List [int ]]) -> bool :
6+ """
7+ - Idea: λͺ¨λ νμμ μ°Έμν μ μμΌλ €λ©΄, μμ μ€λ νμκ° λλλ μκ°μ΄
8+ λ€μ νμμ μμ μκ°μ λμ΄μλ μλλ€.
9+ μ΄λ₯Ό νμΈνκΈ° μν΄ μ£Όμ΄μ§ νμ μΌμ μ μμ μκ° κΈ°μ€μΌλ‘ μ λ ¬νκ³ ,
10+ μμ°¨μ μΌλ‘ λΉκ΅νμ¬ μμ 쑰건μ μλ°νλ νμκ° μλμ§ νμΈνλ€.
11+ - Time Complexity: O(nlogn). nμ νμμ μ.
12+ μ λ ¬μ O(nlogn)μ΄ μμλκ³ , μμ°¨ νμμ νλ λ°λ O(n)μ΄ νμνλ€.
13+ - Space Complexity: O(1).
14+ μΆκ° 곡κ°μ μ¬μ©νμ§ μλλ€.
15+ """
16+ intervals .sort ()
17+
18+ for i in range (len (intervals ) - 1 ):
19+ if intervals [i ][1 ] > intervals [i + 1 ][0 ]:
20+ return False
21+
22+ return True
You canβt perform that action at this time.
0 commit comments