Here is my code
https://www.codechef.com/viewsolution/33000386
Thanks in advance ![]()
1
20 20
18 12 19 7 14 3 6 15 16 5 8 13 20 10 17 9 2 11 4 1
For the given input, your code output is -1 which is wrong. The answer for the above input can be computed in 10 steps.