Pregunta de entrevista de Sabre

Most complex performance problem solved.