Pergunta de entrevista da empresa Bloomberg

A problem based on intervals.