FastPrepThe Skyline Problem
Problems/The Skyline Problem

The Skyline Problem

Google logoGoogle● HardINTERNFULLTIMEPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Google PhD intern report names Skyline as its main coding exercise. A separate Google MLE onsite report dated 2025-10-16 also names skyline but gives no more detail. Our version uses the usual building triple, outputs the critical points, uses half-open building intervals, and has strictly increasing x coordinates.

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] with 0 <= left < right <= 1000000000 and 1 <= height <= 1000000000.
  • Buildings may overlap, touch, or repeat, and the input need not be sorted.

More Google Phone Screen questions

  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Logger Rate Limiter with Every-Arrival HistoryPHONE SCREEN · Seen Nov 2026
  • Minimum Total Layover WaitPHONE SCREEN · Seen Nov 2026
  • Reach a Destination Through Scheduled FlightsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Employee Free TimeIDFC Bank · ONSITE INTERVIEWIDFC Bank interview questions
  • The Skyline ProblemBloomberg LP · ONSITE INTERVIEWBloomberg LP interview questions
  • Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
  • Meeting Rooms IIByteDance · PHONE SCREENByteDance interview questions
  • Generate Complete Inputs for a Supplied ClassifierGeneral Motors · ONSITE INTERVIEW
  • Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Meeting Rooms IISalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Maximum Number of Events That Can Be AttendedSnowflake · PHONE SCREENSnowflake interview questions
  • Minimum Workers with Job AssignmentsLyft · ONSITE INTERVIEWLyft interview questions
  • Meeting Rooms IIRoblox · PHONE SCREENRoblox interview questions

Interview reports that mention this question

  • Google SWE Intern Onsite Questions: 16 Experiences (Part 2 of 3)

Google interview experiences

  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
  • Google AI Coding Interview and AI OA: 2 Experiences
  • Google SWE Intern Interview Results Timeline: 13 Experiences
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public List<List<Integer>> getSkyline(int[][] buildings) {
        // Write your code here.
    }
}
Checking account…