本题和253一模一样。典型的扫描线算法。
我们用一个按key有序的Map。每次调用book函数时,我们就操作Map[start]+=1和Map[end]-=1。然后遍历这个Map的key,按照时间轴的顺序累加差分值,即遇到1就加一,遇到-1就减一。这样就得到每个时刻有多少并行的会议。最终输出其中的最大值。
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/732.My-Calendar-III at master · wisdompeak/LeetCode Expand file tree/ Copy path732.My-Calendar-III/Directory actionsMore optionsMore optionsDirectory actionsMore optionsMore options/ Copy path732.My-Calendar-III/Folders and files
本题和253一模一样。典型的扫描线算法。 我们用一个按key有序的Map。每次调用book函数时,我们就操作 | |||||||||||||||||||||
| 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. | |||||||||||||||||||||