Problem
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.
Example 1
- Input
- clips = [[0, 2], [4, 6], [8, 10], [1, 9], [1, 5], [5, 9]], time = 10
- Output
- 3
Example 2
([0, 2], [1, 9], [8, 10])
Example 3
- Input
- clips = [[0, 1], [1, 2]], time = 5
- Output
- -1
Constraints
1 <= clips.length <= 1000 <= start <= end <= 1001 <= time <= 100