Pregunta de entrevista de Google

Started with a code reading exercise.