Pregunta de entrevista de Microsoft

Iterating through an array using an algorithm