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 fac1fba commit 1552d84Copy full SHA for 1552d84
meeting-rooms/WhiteHyun.swift
@@ -0,0 +1,31 @@
1
+//
2
+// 252. Meeting Rooms
3
+// https://leetcode.com/problems/meeting-rooms/description/
4
+// Dale-Study
5
6
+// Created by WhiteHyun on 2024/05/12.
7
8
+
9
10
+/*
11
+Definition of Interval:
12
+class Interval {
13
+ var start: Int
14
+ var end: Int
15
+ init() { start = 0; end = 0; }
16
+ init(_ a: Int, _ b: Int) { start = a; end = b }
17
+}
18
+ */
19
+final class Solution {
20
+ func canAttendMeetings(_ intervals: [Interval]) -> Bool {
21
+ let sortedIntervals = intervals.sorted { lhs, rhs in
22
+ lhs.start < rhs.start
23
+ }
24
25
+ for i in sortedIntervals.indices.dropFirst() where sortedIntervals[i - 1].end > sortedIntervals[i].start {
26
+ return false
27
28
29
+ return true
30
31
0 commit comments