Pergunta de entrevista da empresa Google

Popular algorithmic problems, I got an interval question.