Amazon interview question

Solve a permutations technical coding problem