Pergunta de entrevista da empresa Google

Given 2 intervals, get the overlapping between 2 intervals