Pergunta de entrevista da empresa Bayer

Write an algorithm to merge adjacent timeboxes into continuous intervals.