PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/Meta

Merge two interval lists into a union

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to implement interval merging algorithms, reason about edge cases such as touching boundaries, empty inputs, and invalid intervals, and perform time and space complexity analysis.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Merge two interval lists into a union

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

You are given two lists of closed intervals [start, end]. Each list is individually sorted by start and contains non-overlapping intervals. Merge the two lists into a single list representing the union of all intervals, returning a minimal set of non-overlapping intervals sorted by start. Specify how you handle touching boundaries (e.g., [1,3] and [3,5]), empty inputs, and invalid intervals (start > end). State the time and space complexity and outline an O(m + n) two-pointer approach.

Quick Answer: This question evaluates a candidate's ability to implement interval merging algorithms, reason about edge cases such as touching boundaries, empty inputs, and invalid intervals, and perform time and space complexity analysis.

Related Interview Questions

  • Solve Two Backtracking Array Problems - Meta (hard)
  • Find a String Containing Another - Meta (medium)
  • Solve Subarray Sum and Local Minimum - Meta (hard)
  • Validate abbreviations and brackets - Meta (medium)
  • Solve Two String Problems - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
0
0

You are given two lists of closed intervals [start, end]. Each list is individually sorted by start and contains non-overlapping intervals. Merge the two lists into a single list representing the union of all intervals, returning a minimal set of non-overlapping intervals sorted by start. Specify how you handle touching boundaries (e.g., [1,3] and [3,5]), empty inputs, and invalid intervals (start > end). State the time and space complexity and outline an O(m + n) two-pointer approach.

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
  • Careers
  • 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.