Lucid Imaging interview question

Insert Intervals from leetcode Medium level problem