Funky chess board

I tried multiple times. Already watched the hint video. But still 1/3 test case is passing. Won’t be able to find any corner case. Can you please look at my code? Thanks in advance.

Hey @himanshugupta8 in your moveKnight function there’s first if condition in that do this, board[i][j]==0 also declare a as global cause it will store answer that moveKnight will send and after each recursion it’s value is updating,
I am attaching code for your help. You can take reference from it.

why are we backtracking?

What if after 8 calls you find out on 9th call that this step is not right fit for answer, so if you will declare all your 9 steps as false just cause of one 9th call then you will again have to compute 8 calls, thus creating a big time complexity. Instead what we are doing is checking from 9,8,…0 step one by one that which was the wrong move we have taken so that we can save our calculated moves and avoid calculating it again and again.

Got it. Thanks :slightly_smiling_face:

Marking it as resolved , do give your feedback.

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.

It is not marking as resolved due to some technical error in CB. I’ve rated my experience. Thanks.