not working for (0,0) testcase only
Knight tours problem
@Krishna-Singh-2678805765519156 Could you provide me the link of problem you are talking about. Also it would be better if you raise doubts in the section it occurs.
this is the knight tour problem…
where i choose a starting position for knight and fill the board
its working for all the positon except (0,0)
@Krishna-Singh-2678805765519156 this solution is not optimised for optimised solution refer warnsdorffs-algorithm-knights-tour-problem
Your code is not giving answer for every position it will give answer for some suitable positions only, and 0,0 is not suitable for your code.
By changing the order of moves (xc and yc) you can make it suitable for 0,0 but it will become unsuited for other position.
to see how changing of moves effect run time, create a global variable of type long long and increment it at the beginning of function and then print it in the main.
You will see that this number is already in 10^6-7 so just a bit change in position will cause TLE.
If this resolves your doubt mark it as resolved.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.