Amazon interview question

The coding problem is permutation.