Pregunta de entrevista de Google

Popular algorithmic problems, I got an interval question.