Why am I failing? I have coded as per the required logic,still failing

Here is the code provided: https://ide.geeksforgeeks.org/w7dYKWQVHE

I guess I am messing with some edge case. Please verify code or logic.

@ayushjain.aj300 hey ayush visit this discuss your code need some modification.visit this discuss

Thanks for the reply Sir. But,the logic used in that code in discussion is different.
Could you please review my code and tell me where am I missing?
Thanks in advance.

@ayushjain.aj300 the logic is that you have to unset the value and then set please follow this step as suggestion apply that suggestion I approach is similar to that discussion.

That’s the confusion sir. I am confused where to set and unset the value. Because if I do that It will go in infinite loop I think. That’s why I am asking you to correct my code. Also,you are counting every move of the knight,while in my code I am not counting the move of Knight instead, I am just allowing my knight to visit every possible square it can visit. And then in the end just printing the squares it can not visit in any manner. So please sir review my code and help me.

@ayushjain.aj300 hey ayush you have to manage a variable which
stores the maximum of the value of visited squares. the question is demanding for “Print the minimum number of squares that the knight can not reach.” and how this thing is achieved count -hi. there is no option you have to manage count in each call.

Alright Sir. I think I misunderstood the question. I thought I have to give the number of squares which is not reachable at all after traversing every possible route. Could you give me a good test case sir?
I would like to dry run my code. Also please could explain me the question in simple terms Sir?

@ayushjain.aj300 hey ayush
3
1 0 0
0 0 1
0 0 0
answer =0
The question is asking about no of squares that knights can’t reach
there is the only simple solution is that the total number of valid cells on chess - the maximum of the value of visited squares.

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.

Yes Sir. You have cleared my doubt. Sorry, I just forgot to close the doubt and rate it. I will do it. Thanks for the help sir.