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.
2 parents 397d338 + 04bbafb commit ea79253Copy full SHA for ea79253
go/0252-meeting-rooms.go
@@ -0,0 +1,27 @@
1
+/**
2
+ * Definition of Interval:
3
+ * type Interval struct {
4
+ * Start, End int
5
+ * }
6
+ */
7
+
8
9
+ * @param intervals: an array of meeting time intervals
10
+ * @return: if a person could attend all meetings
11
12
13
+import "sort"
14
15
+func CanAttendMeetings(intervals []*Interval) bool {
16
+ // Write your code here
17
+ sort.Slice(intervals, func(i, j int) bool {
18
+ return intervals[i].Start < intervals[j].Start
19
+ })
20
21
+ for i := 1; i < len(intervals); i++ {
22
+ if intervals[i].Start < intervals[i - 1].End {
23
+ return false
24
+ }
25
26
+ return true
27
+}
0 commit comments