[leetcode]Meeting Rooms II

将时间点排序就行

class Solution:
    def minMeetingRooms(self, intervals: List[List[int]]) -> int:
        points = []
        for interval in intervals:
            points.append([interval[0], 1])
            points.append([interval[1], -1])

        points.sort()

        result = 0
        cnt = 0
        for point in points:
            cnt += point[1]
            result = max(result, cnt)

        return result

        

  

posted @ 2020-02-09 00:19  阿牧遥  阅读(235)  评论(0编辑  收藏  举报