FastPrepMerge Intervals
Problems/Merge Intervals

Merge Intervals

SeekOut logoSeekOut● MediumONSITE INTERVIEW

Updated Sep 2026

QuestionFunctionExamples

Problem statement

Source note: This problem is backed by a real SeekOut onsite interview report. The report directly named Merge Intervals, but it did not include the exact function interface, examples, constraints, or interval-boundary convention. This judged version uses closed intervals, so the core task match is about 90%.

Given a collection of closed intervals [start, end], merge every pair that overlaps or touches and return the resulting non-overlapping intervals sorted by start.

Function

merge(intervals: int[][]) → int[][]

Examples

Example 1

intervals = [[1,3],[2,6],[8,10],[15,18]]return = [[1,6],[8,10],[15,18]]

Example 2

intervals = [[1,4],[4,5]]return = [[1,5]]

Similar questions at other companies

  • Merge Overlapping IntervalsAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Maximum Intervals Overlapping a Fixed-Length WindowBooking.com · ONSITE INTERVIEW
  • Meeting Rooms IISalesforce · ONSITE INTERVIEWSalesforce interview questions
  • Generate Complete Inputs for a Supplied ClassifierGeneral Motors · ONSITE INTERVIEW
  • Merge IntervalsSafe Security · ONSITE INTERVIEW
  • Merge IntervalsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Merge Overlapping IntervalsCapgemini · ONSITE INTERVIEWCapgemini interview questions
  • Meeting Rooms IIAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Minimum Removals for Non-Overlapping IntervalsByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Merge IntervalsBloomberg LP · OA · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
See SeekOut hiring insights
Saved
class Solution {
    public int[][] merge(int[][] intervals) {
      // write your code here
    }
}
Checking account…