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 ae9e24a commit 9d69acbCopy full SHA for 9d69acb
253-meeting-rooms-ii.js
@@ -67,3 +67,25 @@ const minMeetingRooms = function(intervals) {
67
68
return res
69
}
70
+
71
+// another
72
73
+/**
74
+ * @param {number[][]} intervals
75
+ * @return {number}
76
+ */
77
+const minMeetingRooms = function(intervals) {
78
+ intervals.sort((a, b) => a[0] - b[0] || a[1] - b[1])
79
+ const n = intervals.length
80
+ const pq = new MinPriorityQueue()
81
+ let res = 0
82
+ for(const [s, e] of intervals) {
83
+ while(!pq.isEmpty() && s >= pq.front().element) {
84
+ pq.dequeue()
85
+ }
86
+ pq.enqueue(e)
87
+ res = Math.max(res, pq.size())
88
89
90
+ return res
91
+}
0 commit comments