Amazon interview question

Array based coding question was asked