Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Interval merge for maintenance windows

Python data engineering interview problem. Difficulty: advanced. Pattern: Sorting. About 20 minutes. Part of the Pro drill bank.

Maintenance windows are intervals on a timeline. Overlapping windows should merge so the calendar shows one closed period instead of three stacked ones.

Merge overlapping maintenance intervals.

Requirements

  • Overlapping or touching intervals become one.
  • Non-overlapping intervals stay separate.

Constraints

  • windows: list of [start, end] pairs.
  • Unsorted input must still work.

Examples

Input: merge_windows([[1, 3], [2, 6], [8, 10]]) Output: [[1, 6], [8, 10]] This input follows the stated rules and produces this output.

Topics: lakebench, python, sorting.

More Python interview questions · All interview problems · Learn data engineering

advanced

Interval merge for maintenance windows

Interview-style drill: Merge a list of overlapping maintenance time windows into the minimal set of non-overlapping windows.

Merge overlapping maintenance intervals.