Given a list of buildings `buildings[i] = [left, right, height]`, compute the skyline formed by these buildings as a list of key points [x, height]. **Pattern focus:** Event-Based Sweep Line. Use a max-heap or sorted events to track active building heights.
Example 1:
Input:
buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]
Output:
[[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]
Explanation:
The skyline has critical points at [2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0].
Example 2:
Input:
buildings = [[0,2,3],[2,5,3]]
Output:
[[0,3],[5,0]]
Explanation:
Two adjacent buildings of height 3 form skyline [0,3] to [5,0].