Minimum video clips
You have clips that each cover a sub-interval [start, end] of a video that runs from time 0 to time T. You want to cover the entire interval [0, T] using as few clips as possible (clips may overlap and may be cut). Return the minimum number of clips needed, or -1 if [0, T] cannot be fully covered. There are at most 1000 clips, and 0 <= start < end, with T between 1 and 1000.
Implement
min_clips(clips: list[list[int]], T: int) → intExamples
in
[[[0,2],[4,6],[8,10],[1,9],[1,5],[5,9]],10]out3What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 25 min
solution.py
InputExpectedGot
[[[0,2],[4,6],[8,10],[1,9],[1,5],[5,9]],10]3not run yetsample