Pergunta de entrevista da empresa Oracle

lc type question similar to merge intervals