Atlassian Interview Question: Find Overlapping Pipeline Intervals (Interval Overlap Problem)

17 Views
No Comments

Problem – Find Overlapping Pipeline Intervals

Find all time intervals during which at least two pipelines are running at the same time.

You are given a list of half-open or closed intervals (assume closed here) where each interval
[start, end] represents the running time of one pipeline.

Return all sub-intervals where the number of running pipelines is ≥ 2.

Example

Input:
[[2, 5], [12, 15], [4, 8]]

Output:
[[4, 5]]

Because between time 4 and 5, both the interval [2, 5] and [4, 8] are running.


In English: Use a sweep-line. Turn each interval into start/end events, sort them, maintain a running count; whenever count goes from 1→2, start an overlap; when it drops from 2→1, close the overlap and record it.

The VOprep team has long accompanied candidates through various major company OAs and VOs, including Meta, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for these companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.

END
 0