Pregunta de entrevista de The Akanksha Fund

How would you merge overlapping intervals in an array?