Meta interview question

Basically an array manipulation problem