Practice The Skyline Problem
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
The Skyline Problem
Problem Statement
Each building is [left, right, height], defining a rectangle over that horizontal interval with its base on the ground. At each horizontal position, the skyline height is the tallest building covering it, or zero in a gap. Return the skyline as [x, height] key points ordered by x. A point starts a horizontal skyline segment. The final point is the rightmost end with height 0. Combine consecutive segments of the same height so adjacent key points never have equal heights.
Source: The Skyline Problem on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]
[[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]
# Example 2
buildings = [[0,2,3],[2,5,3]]
[[0,3],[5,0]]
Constraints
Related LeetCode Problems
Practice more problems similar to The Skyline Problem.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.