Merge overlapping intervals
Company: Atlassian
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
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.
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
- Clarify edge cases before coding.
- Keep the return value deterministic.