Microsoft Interview Question

The question was similar to the Merge Intervals LeetCode question