Solution: The Skyline Problem
Explore how to solve the Skyline Problem by using the union-find algorithm to merge overlapping building edges and construct the city skyline. Understand the process of sorting coordinates, applying union-find to connect segments, and generating the outline points where heights change. This lesson helps you master an efficient technique for skyline construction with O(n log n) complexity.
We'll cover the following...
We'll cover the following...
Statement
Imagine standing at a distance, viewing the skyline of a city. The skyline is the shape formed by all the buildings in the city when viewed together. Your task is to determine the shape of this skyline, given all the buildings’ position and height. Each building is represented by three values in the array buildings, where