Fenergo interview question

Coding challenge was related to array permutation.