Microsoft interview question

Array traversal