Fewest Clips Needed to Cover a Full Live Broadcast
Last updated: November 29, 2026
Quick Overview
A Facebook Live broadcast of length T was recorded by several devices as clips [start, end]. Return the minimum number of clips whose union covers [0, T], or -1 if it cannot be covered.
Meta
November 29, 20260
0
0 solved
A Facebook Live broadcast of length T was recorded by several devices as clips [start, end]. Return the minimum number of clips whose union covers [0, T], or -1 if it cannot be covered.
An interval-cover greedy in the style of Meta's onsite coding round, framed as assembling a highlight-free full replay from overlapping device recordings. Interviewers check that you pick the farthest-reaching clip among those that start within the covered prefix, the same jump-game structure in interval form.
What the Interviewer Expects
- Clarifies closed intervals and that clips may extend beyond T
- Identifies the greedy: from the covered prefix, extend as far as possible
- Implements it in one pass after sorting, or with a reach array
- Returns -1 on any gap
- Argues correctness by comparing reach after k picks
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 return the actual clips chosen?
- What if each clip has a cost and you want minimum total cost?
- How does this relate to the jump game problem?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: list of [start, end] clips and length T. Output: minimum number of clips covering every point in [0, T], or -1. Clips may overlap, start after T, or extend past T. T = 0 needs zero clips....
High-Level Design
Sort clips by start. Maintain covered, the right edge of what the chosen clips already cover, and reach, the farthest end among clips that start at or before covered. Scan clips: while the next ...