Problem
Cars are parked on a number line. nums[i] = [start, end] means car i covers every integer point from start to end, inclusive. Cars may overlap. Return the number of integer points covered by at least one car.
Example 1
- Input
- [[3, 6], [1, 5], [4, 7]]
- Output
- 7
- Why
- points 1 to 7
Example 2
- Input
- [[1, 3], [5, 8]]
- Output
- 7
- Why
- 1, 2, 3, 5, 6, 7, 8
Constraints
1 <= nums.length <= 1001 <= start <= end <= 100