Funky Chess Board

Whats wrong in this code??
2/3 test case is failing

You are not applying backtracking properly …we have to consider each path of it and count of the number of cells visited in that path and minimise that number. Your code simply counts the number of all the possible cells that the knight can reach in total.

That is ,you have find one path where the knight can cover the maximum no of cells and your knight has to stick to it without going back.

After calling the function you are returning the value, which prevents backtracking.

refer this code https://ide.codingblocks.com/s/586966

What I am doing is marking all the possible places where knight can visit and counting all the places where knight can’t reach. why we have to apply backtracking here?

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.

What I am doing is marking all the possible places where knight can visit and counting all the places where knight can’t reach. why we have to apply backtracking here?

Because u have to explore all possible options… like the night can move in 8 directions… so i a particular move it can go somewhere and u have to explore all paths