Funky chess board

not getting approach and also not understood question also.

hello @guptashubham210a in this question a knight can move or take positions like this
(r-2,c-1), (r-2,c+1), (r-1,c-2), (r-1,c+2), (r+1,c-2), (r+1,c+2), (r+2,c-1), or (r+2,c+1) .
suppose the knight starts from intital (0,0) and then it will try for all the possible moves mentioned above and the possible positions will be marked as 0 and if at any point it goes out of board then you have to back track and mark the position as 1 again .
at every possible move you have to increment a count variable .
when you are taking the input of the board array then also increment a count2 and inorder to minimise the answer you have to just the subtract count from count 2.
take the example of the given test case
3
1 1 1
1 1 1
1 1 1
total places where knight can go are 9
in this test case the places your knight can visit are
0 0 0
0 1 0
0 0 0
these are in total where knight has visited are 8
so 9-8 is 1 thats how the anser came .
i hope you have got the idea about the approach .
do you want me to give the code or you will try yourself ?

@tusharaggarwal272
so 1 is the min no where he cant go ?
to find that we have substracted max where knight can move from total?

yes right @guptashubham210a …

hey @guptashubham210a as you are not replying i am marking this doubt as resolved.
on or off the chance if you feel you still have any doubt you can open this again .
Happy Learning !!

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.