Https://discuss.codechef.com/t/permutation-problem/23208

can someone provide the solution to this