Permuting digits problem

Question

Hints

Answer