Amazon Interview Question

Something related to iterating through an array, really not that difficult.