遍历所有的interval,将这样所有的{start,1}和{end,-1}加入一个数组q.然后将q排序.注意,对于同一个时刻,{end,-1}会比{start,1}先处理.这在本题是合理的,因为所有的有效区间的长度都至少为1,这样的话类似[t,t]这样的区间就不会被包括进来.
我们依次遍历这个q的元素,将第二个label的值累加进count.发现当count>1时,即说明有两个重合的区间,返回false
GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — LeetCode/Others/252.Meeting-Rooms at master · wisdompeak/LeetCode Expand file tree/ Copy path252.Meeting-Rooms/Directory actionsMore optionsMore optionsDirectory actionsMore optionsMore options/ Copy path252.Meeting-Rooms/Folders and files
遍历所有的interval,将这样所有的{start,1}和{end,-1}加入一个数组q.然后将q排序.注意,对于同一个时刻,{end,-1}会比{start,1}先处理.这在本题是合理的,因为所有的有效区间的长度都至少为1,这样的话类似[t,t]这样的区间就不会被包括进来. 我们依次遍历这个q的元素,将第二个label的值累加进count.发现当count>1时,即说明有两个重合的区间,返回false | |||||||||||||||||||||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | |||||||||||||||||||||