#1885Hard#48 in Uber's list· asked at 5 companies
The Skyline Problem
Hosted on LeetCode
Solve it on LeetCode, track it here.
This problem's full statement lives on LeetCode. Open it in a new tab, then come back to mark it solved, add notes and keep your streak.
LeetCode Premium locked?
Most company-tagged LeetCode problems are behind Premium. If you have ChatGPT Plus or Claude Pro, ask it for the full statement, examples and constraints. The buttons below open a chat with the prompt already filled in.
What we know
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]]
Example 2
Input: buildings = [[0,2,3],[2,5,3]] Output: [[0,3],[5,0]]
Constraints
- •
1 <= buildings.length <= 10^4 - •
0 <= left_i < right_i <= 2^31 - 1 - •
1 <= height_i <= 2^31 - 1 - •
buildingsis sorted byleft_iin non-decreasing order.