# DIY: The Skyline Problem

Solve the interview question "The Skyline Problem" in this lesson.

## We'll cover the following

## Problem statement

Given a `buildings`

list, you have to draw the skyline of the outer contour of the city. The citys’ skyline is formed by the silhouette of all of its buildings.
Each building in this `buildings`

list consists of the following information:

**left**: The x-coordinate of the left edge of the building._{i}**right**: The x-coordinate of the right edge of the building._{i}**height**: The height of the building._{i}

The skyline should consist of a list of coordinates, sorted according to their x-coordinates. This list should be in the form of [[x_{1},y_{1}],[x_{2 },y_{2}],…[x_{n },y_{n}]]. Each coordinate in the skyline is the left coordinate of a horizontal segment, except the last point, whose y-coordinate is always be **0**. We will use this last point to mark the end, where the rightmost building ends. In the skyline, no two consecutive coordinates should have the same y-coordinate. For example, `[[2,3],[4,3],[7,3]]`

is not acceptable. They should be merged into one coordinate, that is `[2,3]`

to be accepted.

Note: You may assume that all the buildings are perfect rectangles and are grounded on height0.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.