Facebook | Least number of intervals to cover target interval

16817
Jun 28, 2016
Jul 29, 2019

Given a list of intervals A and one interval B, find the least number of intervals from A that can fully cover B.
If cannot find any result, just return 0.

Example 1:

Input: A = [[0, 3], [3, 4], [4, 6], [2, 7]] B = [0,6]
Output: 2
Explanation: We can use [0, 3] [2, 7] to cover the B

Example 2:

Input: A = [[0, 3], [4, 7]] B = [0, 6]
Output: 0
Explanation: We cannot find any interval combination from A to cover the B

Similar question: https://leetcode.com/problems/video-stitching

Comments (16)