Pregunta de entrevista de Neighborhoods.com

Algorithm question