Video Stitching
MediumIntervals
Decode it first. Clues, constraints, pattern and plan before any code.A sporting event lasted time seconds. You have video clips, each clips[i] = [start, end], and clips may overlap or be any length. You can cut a clip into smaller pieces freely. Return the minimum number of clips needed to cover the whole event [0, time], or -1 if it cannot be covered.
clips = [[0, 2], [4, 6], [8, 10], [1, 9], [1, 5], [5, 9]], time = 10 → 3
([0, 2], [1, 9], [8, 10])
clips = [[0, 1], [1, 2]], time = 5 → -1Constraints
1 <= clips.length <= 1000 <= start <= end <= 1001 <= time <= 100