天天看點

模闆題目:Interval (LeetCode253:Meeting Rooms I: I, LeetCode729: My Calendar I)

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],…] (si < ei), find the minimum number of conference rooms required.

這道題可以說是greedy的經典題目了。我們把這道題複述一下,其實意思就是求所有時刻的最大深度,傳回這個深度就是傳回最少用幾個房間。

我也不知道這種題目有啥模闆可言 如果非要說有的話 那就是Greedy吧