FastPrepInterval List Intersections
Problems/Interval List Intersections

Interval List Intersections

Google logoGoogle● MediumNEW GRADONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report labels the task Interval Intersection. The original author does not answer a comment asking whether it means intersection or union. We follow the label and use the usual task of intersecting two sorted lists of disjoint intervals. We chose how interval ends work, the signature, the examples, and the input limits. Our version is about 78% the same as the reported question.

firstList and secondList are lists of intervals that include both endpoints. Within each list, intervals do not overlap and are sorted by start.

Return every nonempty intersection between an interval from the first list and an interval from the second list, in sorted order. If two intervals share only an endpoint, include that point as an interval.

Function

intervalListIntersections(firstList: int[][], secondList: int[][]) → int[][]

Examples

Example 1

firstList = [[0,2],[5,10]]secondList = [[1,5],[8,12]]return = [[1,2],[5,5],[8,10]]

The intervals overlap at [1,2], the shared endpoint 5, and [8,10].

Example 2

firstList = []secondList = [[1,3]]return = []

An empty list has no intersections.

Example 3

firstList = [[1,7]]secondList = [[2,3],[5,6]]return = [[2,3],[5,6]]

Both second-list intervals lie inside [1,7].

Constraints

  • 0 <= firstList.length, secondList.length <= 100000.
  • -1000000000 <= start <= end <= 1000000000.
  • Each list is sorted by start and internally pairwise disjoint.

More Google Onsite Interview questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Distinct Subset SumsONSITE INTERVIEW · Seen Nov 2026
  • Playlist With No Same Artist in a RowONSITE INTERVIEW · Seen Nov 2026
  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Meeting Rooms IIUber · PHONE SCREENUber interview questions
  • Common Camera Motion IntervalsVerkada · PHONE SCREENVerkada interview questions
  • Intersect Two Sorted Interval ListsByteDance · PHONE SCREENByteDance interview questions
  • Meeting Rooms IIWalmart · PHONE SCREENWalmart interview questions
  • Intersect Two Interval ListsSuperhuman · PHONE SCREENSuperhuman interview questions
  • Find Shared Camera Activity PeriodsServal · PHONE SCREEN
  • Most Employees Working at OnceCitadel · OACitadel interview questions
  • Minimum Machines for TasksExpedia · OAExpedia interview questions
  • Earliest Common Meeting SlotAdobe · PHONE SCREENAdobe interview questions

Interview reports that mention this question

  • Google PhD New Grad SWE Interview Questions: 1 Experience

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int[][] intervalListIntersections(int[][] firstList, int[][] secondList) {
        // write your code here
    }
}
Checking account…