Pregunta de entrevista de Bloomberg

A problem based on intervals.