Elastica interview question

array manipulation