The Skyline Problem
Updated
Problem statement
Each building is represented by [left, right, height] and covers the half-open horizontal interval [left, right). The skyline is the outer contour formed by the union of all buildings.
Return its critical points as rows [x, height] in increasing x order. A critical point records every x coordinate where the visible maximum height changes. Do not return adjacent points with equal heights, and include the final point where the skyline returns to height 0. Return an empty matrix when there are no buildings.
Function
getSkyline(buildings: int[][]) → List<List<Integer>>Examples
Example 1
buildings = [[2,9,10],[3,7,15],[5,12,12],[15,20,10],[19,24,8]]return = [[2,10],[3,15],[7,12],[12,0],[15,10],[20,8],[24,0]]The tallest active building changes at x coordinates 2, 3, 7, 12, 15, 20, and 24.
Example 2
buildings = [[0,2,3],[2,5,3]]return = [[0,3],[5,0]]The touching buildings have equal height, so x = 2 does not change the skyline and is not a critical point.
Constraints
0 <= buildings.length <= 100000- Every building is
[left, right, height]with0 <= left < right <= 1000000000and1 <= height <= 1000000000. - Buildings may overlap, touch, or repeat, and the input need not be sorted.
More Bloomberg LP Onsite Interview questions
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent WordsONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Decode StringPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Minimum Replacements to Make Two Strings AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Employee Free TimeIDFC Bank · ONSITE INTERVIEWIDFC Bank interview questions
- The Skyline ProblemGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Meeting Rooms IISalesforce · ONSITE INTERVIEWSalesforce interview questions
- Generate Complete Inputs for a Supplied ClassifierGeneral Motors · ONSITE INTERVIEW
- Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
- Minimum Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions
- Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
- Meeting Rooms IIByteDance · PHONE SCREENByteDance interview questions
- Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
- Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
Bloomberg LP interview experiences
- Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
- Bloomberg SWE Intern Interview Questions: 68 Questions
- Bloomberg Interview Questions, Level Not Reported: 65 Questions
- Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
- Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
- Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)