Python data engineering interview problem. Difficulty: intermediate. Pattern: Intervals. About 14 minutes. Part of the Pro drill bank.
Merge all overlapping intervals. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement merge_intervals(intervals: list) -> list where each interval is [start, end].
Input: merge_intervals([[1, 3], [2, 6], [8, 10], [15, 18]]) Output: [[1, 6], [8, 10], [15, 18]] 1-3 and 2-6 merge.
Topics: lakebench, python, merge, intervals.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Merge all overlapping intervals.
Implement `merge_intervals(intervals: list) -> list` where each interval is `[start, end]`. Example: `[[1, 3], [2, 6], [8, 10], [15, 18]]` → `[[1, 6], [8, 10], [15, 18]]`. Keep the harness.