Grab interview question

array manipulation problem- online test