The Akanksha Fund interview question

How would you merge overlapping intervals in an array?