Amazon interview question

Solve array questions on a specific problem given