Meeting Rooms
Example
# Definition of Interval.
# class Interval(object):
# def __init__(self, start, end):
# self.start = start
# self.end = end
class Solution:
"""
@param intervals: an array of meeting time intervals
@return: if a person could attend all meetings
"""
def canAttendMeetings(self, intervals):
# Write your code here
times=[]
for i in intervals:
times.append((i.start,1))
times.append((i.end,-1))
times.sort()
s=0
for _,d in times:
s+=d
if s>1:
return False
return TrueLast updated