Amazon interview question

Array manipulation. Pretty easy.