UKG interview question

The DSA question was from Leetcode and was merging intervals.