## Question 1 What will be the updated list of intervals? existing_intervals = $[[1, 3], [4, 5], [7, 8], [9, 12], [13, 14]]$ new_interval = $[2, 10]$ ### Options 1. $[[1, 12], [13, 14]]$ Correct Since we added the interval [2, 10] into the existing intervals list, we merged it with [1, 3], [4, 5], [7, 8], and [9, 12] one by one. ---------------------------- 2. $[[1, 3], [2, 10], [4, 5], [7, 8], [9, 12], [13, 14]]$ Incorrect ---------------------------- 3. $[[2, 10], [13, 14]]$ Incorrect ---------------------------- --------------------------------------------- ## Question 2 What will be the updated list of intervals? existing_intervals = $[[1, 2],[3, 5],[6, 7],[8, 10],[12, 16]]$ new_interval = $[4, 8]$ ### Options 1. $[[1, 2], [3, 4], [5, 7], [8, 10], [12, 16]]$ Incorrect ---------------------------- 2. $[[1, 2], [4, 10], [12, 16]]$ Incorrect ---------------------------- 3. $[[1, 2], [3, 4], [5, 10], [12, 16]]$ Incorrect ---------------------------- 4. $[[1, 2], [3, 10], [12, 16]]$ Correct Since we added the interval [4, 8] into the existing intervals list, we merged it with [3, 5], [6, 7], and [8, 10] one by one. ---------------------------- --------------------------------------------- ## Question 3 What will be the updated list of intervals? existing_intervals = $[[1, 2],[5, 7],[8, 10]]$ new_interval = $[3,4]$ ### Options 1. $[[1, 2], [3, 4], [5, 7], [8, 10]]$ Correct Since the interval [3,4] doesn't overlap with any other interval in the existing list, we have simply added it as it is. ---------------------------- 2. $[[1, 3], [5, 7], [8, 10]]$ Incorrect ---------------------------- 3. $[[1, 10]]$ Incorrect ---------------------------- 4. $[[1, 3], [4, 6], [7, 10]]$ Incorrect ---------------------------- --------------------------------------------- ## Question 4 What will be the updated list of intervals? existing_intervals = $[[3, 5]]$ new_interval = $[1, 10]$ ### Options 1. $[[1, 3], [4, 10]]$ Incorrect ---------------------------- 2. $[[1, 10]]$ Correct Since the existing interval [3, 5] is in the range of the new interval [1, 10], both of them were merged. ---------------------------- 3. $[[1, 3], [4, 6], [7, 10]]$ Incorrect ---------------------------- 4. $[[3, 5]]$ Incorrect ---------------------------- ---------------------------------------------