Given an array of meeting time
intervals
whereintervals[i] = [starti, endi]
, determine if a person could attend all meetings.
Time spent: 1m | Runtime: 15.07% | Memory: 57.14%
class Solution:
def canAttendMeetings(self, intervals: List[List[int]]) -> bool:
intervals.sort()
prev_end = -1
for start, end in intervals:
if start < prev_end:
return False
prev_end = end
return True