Microsoft interview question

Iterating through an array using an algorithm