PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Meta

Merge overlapping time intervals

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of interval arithmetic, sorting and array manipulation, specifically the ability to merge overlapping ranges efficiently.

  • easy
  • Meta
  • Coding & Algorithms
  • Software Engineer

Merge overlapping time intervals

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

## Problem You are given a list of **closed** intervals `intervals`, where each interval is `[start, end]` and `start <= end`. Merge all intervals that overlap and return the resulting list of merged intervals. Two intervals `[a, b]` and `[c, d]` are considered overlapping if `c <= b` (i.e., touching at an endpoint also counts as overlapping). ## Input - `intervals`: a list of `n` intervals, each represented as two integers `[start, end]`. ## Output - A list of merged, non-overlapping intervals, sorted by increasing `start`. ## Constraints - `0 <= n <= 1e5` - `-1e9 <= start <= end <= 1e9` ## Example Input: `[[1,3],[2,6],[8,10],[15,18]]` Output: `[[1,6],[8,10],[15,18]]`

Quick Answer: This question evaluates a candidate's understanding of interval arithmetic, sorting and array manipulation, specifically the ability to merge overlapping ranges efficiently.

Related Interview Questions

  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve a Key-Door Corridor Maze - Meta (medium)
  • Solve Array Merge and Parentheses Cleanup - Meta (medium)
  • Solve Two Backtracking Array Problems - Meta (hard)
  • Solve Maze and Suffix Problems - Meta (medium)
Meta logo
Meta
Dec 15, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

Problem

You are given a list of closed intervals intervals, where each interval is [start, end] and start <= end.

Merge all intervals that overlap and return the resulting list of merged intervals.

Two intervals [a, b] and [c, d] are considered overlapping if c <= b (i.e., touching at an endpoint also counts as overlapping).

Input

  • intervals : a list of n intervals, each represented as two integers [start, end] .

Output

  • A list of merged, non-overlapping intervals, sorted by increasing start .

Constraints

  • 0 <= n <= 1e5
  • -1e9 <= start <= end <= 1e9

Example

Input: [[1,3],[2,6],[8,10],[15,18]]

Output: [[1,6],[8,10],[15,18]]

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Meta•More Software Engineer•Meta Software Engineer•Meta Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.