Funky chess board

Can you please explain why this code is not working for Funky Chess Board Problem in Recusrion challenges section?

Hi @sivaganeshdaggubati,

According to the question,

not reach in any number of moves without resting in any square more than once?

knight cannot move to the square again if it is already visited like this
N = 4
1 0 0 0
0 0 1 0
0 1 1 0
0 1 0 0

Now in this case you can either go from (1,1) to (2,3) or (3,2) but not both.

I am not visiting the square if it is visited.I wrote the condition in the base case, i am trying all the possibilities and making the unvisited squares as minimum.

No, your conditions are wrong try running the above input and check your output,
the correct answer is: 2

You are counting both (1,1) -> (2,3) and (1,1) -> (3,2)

Ok i understood that at each and every position we need select the next position that minimizes the number of unvisited nodes …is it right?

Yes @sivaganeshdaggubati

Thank you for the response…I got the answer​:slight_smile::+1:

1 Like

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.