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 9d69acb commit 45a5e1dCopy full SHA for 45a5e1d
253-meeting-rooms-ii.js
@@ -89,3 +89,25 @@ const minMeetingRooms = function(intervals) {
89
90
return res
91
}
92
+
93
+// another
94
95
+/**
96
+ * @param {number[][]} intervals
97
+ * @return {number}
98
+ */
99
+const minMeetingRooms = function(intervals) {
100
+ const hash = {}
101
+ for(const [s, e] of intervals) {
102
+ hash[s] = (hash[s] || 0) + 1
103
+ hash[e] = (hash[e] || 0) - 1
104
+ }
105
+ let res = 0, cur = 0
106
+ const keys = Object.keys(hash).map(e => +e)
107
+ keys.sort((a, b) => a - b)
108
+ for(const k of keys) {
109
+ cur += hash[k]
110
+ res = Math.max(res, cur)
111
112
+ return res
113
+};
0 commit comments