Pregunta de entrevista de Softwire

Remaking a nested for loop ignoring useless iterations