Total Ground Station Coverage From Overlapping Contact Windows
Last updated: November 29, 2026
Quick Overview
Each ground station reports contact windows `(start, end)` in seconds during which it can hear a vehicle. Compute the total seconds of coverage across all stations and list every coverage gap longer than a given threshold.
Spacex
November 29, 20260
0
0 solved
Each ground station reports contact windows `(start, end)` in seconds during which it can hear a vehicle. Compute the total seconds of coverage across all stations and list every coverage gap longer than a given threshold.
A short coding problem for SpaceX mission operations or ground software, where planners need to know when a Dragon capsule or upper stage will be out of contact during a mission. The interviewer looks for the sort and merge pattern, correct handling of touching windows, and clean output.
What the Interviewer Expects
- Sort windows by start time before merging
- Merge overlapping and touching windows into continuous coverage
- Sum merged lengths, never the raw windows, to avoid double counting
- Compute gaps between consecutive merged windows and filter by threshold
- State O(n log n) complexity and why sorting dominates
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you also report which station covers each merged segment?
- What changes if you need at least two stations in view at all times for redundancy?
- How would you handle windows streaming in live and out of order?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Windows are half-open [start, end) in seconds; windows that touch (one ends at 12, the next starts at 12) count as continuous coverage. Return (total_covered_seconds, gaps) where each gap `(gap_st...
High-Level Design
Sort by start. Walk the list, extending the current merged window while the next start is at or before the current end. Once merged, total coverage is the sum of merged lengths, and gaps are the space...