13 line sweep

这种题基本做法是:把每个点的起点,终点拆开,排个序。然后遇到起点+,遇到终点-。不过得注意起点终点重叠的情况,得看题目要求,例如是否包括,是起点先算还是终点先算。

L391 Number of Airplanes in the Sky

370 Range Addition

ctci 16.10 Living People

253 Meeting Rooms II

pramp mock 8 - Busiest Time in The Mall

554 Brick Wall

other related:

252 Meeting Rooms -- interval

L131 Building Outline (218 The Skyline Problem) --- 要按大楼的点排序,有点相似。要用到heap。

Last updated