Skip to content

Commit

Permalink
Create 253-Meeting-Rooms-ii.py
Browse files Browse the repository at this point in the history
  • Loading branch information
neetcode-gh authored Mar 28, 2022
1 parent 52864dd commit 7512978
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions 253-Meeting-Rooms-ii.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class Solution:
"""
@param intervals: an array of meeting time intervals
@return: the minimum number of conference rooms required
"""
def minMeetingRooms(self, intervals):
start = sorted([i.start for i in intervals])
end = sorted([i.end for i in intervals])

res, count = 0, 0
s, e = 0, 0
while s < len(intervals):
if start[s] < end[e]:
s += 1
count += 1
else:
e += 1
count -= 1
res = max(res, count)
return res

0 comments on commit 7512978

Please sign in to comment.