Search⌘ K
AI Features

The Skyline Problem

The Skyline Problem gives rectangular buildings with positions and heights, sorted by left edge. Return the city outline as points where height changes, ending at zero and merging adjacent equal-height segments.

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 ...