PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates understanding of interval manipulation, array processing, and algorithmic efficiency by requiring reasoning about overlapping ranges and proper handling of edge cases.

  • medium
  • Atlassian
  • Coding & Algorithms
  • Software Engineer

Merge overlapping intervals

Company: Atlassian

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Given an array of closed intervals `intervals`, where each interval is `[start, end]` and `start <= end`, merge all overlapping intervals and return an array of the merged, non-overlapping intervals sorted by start time. Two intervals `[a, b]` and `[c, d]` overlap if `c <= b` (assuming `a <= c`). #### Input - `intervals`: list of `n` intervals #### Output - A list of merged intervals. #### Example Input: `[[1,3],[2,6],[8,10],[15,18]]` Output: `[[1,6],[8,10],[15,18]]` #### Constraints - `1 ≤ n ≤ 10^5` - Interval endpoints fit in 32-bit integers.

Quick Answer: This question evaluates understanding of interval manipulation, array processing, and algorithmic efficiency by requiring reasoning about overlapping ranges and proper handling of edge cases.

Merge overlapping closed intervals and return sorted non-overlapping intervals.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

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

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

Explanation: Overlapping intervals merge.

Input: ([[1,4],[4,5]],)

Expected Output: [[1, 5]]

Explanation: Touching closed intervals merge.

Input: ([[5,6],[1,2]],)

Expected Output: [[1, 2], [5, 6]]

Explanation: Output is sorted by start.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ 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
  • AI Coding 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.

Related Coding Questions

  • Find a secret word using match feedback - Atlassian (hard)
  • Compute a moving average on a stream - Atlassian (hard)
  • Implement sliding-window rate limiter function - Atlassian (medium)
  • Implement sequential and parallel URL requests - Atlassian (medium)
  • Merge intervals and design rating APIs - Atlassian (medium)