Merge overlapping intervals
Company: Microsoft
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates proficiency in interval manipulation, array-based data structures, algorithm design, and time/space complexity analysis, focusing on merging overlapping numeric ranges into non-overlapping sorted 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: Closed intervals touching at an endpoint merge.
Input: ([],)
Expected Output: []
Explanation: Empty input returns empty output.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.