You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add (rise time, height) and (end time, -height) to one list.
sorted by time min->x, when time are the same, sorted by height max - min. Because if a building is rise when a building is end, we need to increase the sky line then remove the lower sky line.
if the height is positive, add it to the max heap. if negitive, delete it from the heap.
add record the ans of (time, height) when the height is changed. use a prevHeight and curHeight for logging the height change.
heapq does not have remove function so needs to use SortedList