Pergunta de entrevista da empresa The Akanksha Fund

How would you merge overlapping intervals in an array?