将所有的区间按照左端点排序,如果左端点相同的话,优先处理大区间。
我们顺序处理某个区间i,假设为[a,b]:后面的区间j的左端点一定都比a晚,如果j的右端点也比b早的话,那么j一定就是被包含在i里面的。我们可能会遇到若干个这样的j,但区间j会越来越靠右。直至发现j的右端点比b晚,说明j已经跑出了i的覆盖范围,那么我们就把j当作i,重复之前的操作。
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/Greedy/1288.Remove-Covered-Intervals at master · wisdompeak/LeetCode Expand file tree/ Copy path1288.Remove-Covered-Intervals/Directory actionsMore optionsMore optionsDirectory actionsMore optionsMore options/ Copy path1288.Remove-Covered-Intervals/Folders and files
| |||||||||||||||||||||
| 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. | |||||||||||||||||||||