Pregunta de entrevista de Google

Only algorithm problems are involved