[[s1,e1],[s2,e2],...]
(s
i < e
i), determine if a person could attend all meetings.
[[0, 30],[5, 10],[15, 20]]
,
false
.
The problem looks very similar to the merge interval and insert intervals. So the idea is still the same: first sort the intervals according to the start times, then check if there is any overlap.
所以正确的解法是将intervals中所有的interval都按start time进行排序,然后判断是否有overlap,如果有overlap就返回false,否则返回true。
The idea is from here
http://buttercola.blogspot.com/2015/08/leetcode-meeting-rooms.html