Facebook | Least number of intervals to cover target interval
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2016-06-28Added By Anonymous
Source: Link
Company: Meta
Role: e3, e4
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
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