Shopee Interview Question

Merge range problem, similar to the one on leetcode