Fewest Camera Clips to Cover an Entire Live Event Timeline

Last updated: November 29, 2026

Quick Overview

A Prime Video live event runs from second 0 to T, and several camera recordings are available as [start, end] intervals. Return the minimum number of clips whose union covers all of [0, T], or -1 if it cannot be covered.

Amazon
Coding & Algorithms
Software Engineer
Amazon
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


A Prime Video live event runs from second 0 to T, and several camera recordings are available as [start, end] intervals. Return the minimum number of clips whose union covers all of [0, T], or -1 if it cannot be covered.

An Amazon onsite greedy interval question in a streaming setting. The interviewer wants the jump-game style sweep (furthest reach from the current covered prefix) and a clear statement of why picking the clip that reaches furthest is safe.

What the Interviewer Expects
  • Sorts or buckets clips by start
  • Extends coverage greedily from the current frontier
  • Picks the clip reaching furthest among those that start within coverage
  • Detects gaps and returns -1
  • Runs in O(n log n) or O(n + T)
Key Topics to Cover
greedy
interval covering
sorting
sweep
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Minimize total clip duration instead of count.
  • Each clip has a licensing cost: minimize cost.
  • Return the chosen clips.
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: list of [start, end] with 0 <= start <= end, and integer T > 0. Output: min number of clips covering [0, T] (clips can be trimmed, so overlap is fine), or -1....

High-Level Design

Sort clips by start. Keep covered, the end of the prefix already covered, starting at 0. In each round, look at every clip whose start is at most covered and find the furthest end among them. If t...


Submit Your Answer
Markdown supported