Pergunta de entrevista da empresa IBM

Sort intervals based on end time.