Leetcode 252 Meeting Rooms

739 ワード

Given an array of meeting time intervals consisting of start and end times  [[s1,e1],[s2,e2],...]  (s
i < e
i), determine if a person could attend all meetings.
For example,
Given  [[0, 30],[5, 10],[15, 20]] ,
return  false .
Understand the problem:
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