Intervals - Meeting Rooms I
Consider the following Python code that determines if a person can attend all meetings given a list of intervals. What is the return value when the input is [[7,10],[2,4]]?
from typing import List
def can_attend_meetings(intervals: List[List[int]]) -> bool:
intervals.sort(key=lambda x: x[0])
end = float('-inf')
for interval in intervals:
if interval[0] < end:
return False
end = interval[1]
return True
print(can_attend_meetings([[7,10],[2,4]]))
