Shopee interview question

Merge range problem, similar to the one on leetcode