Kindly check why 2 test cases are not passing
CrossWord Recursion
@duttrohan0302 Your logic is wrong.
Lets take an example to it to you:-
2
ae bc
2
ab
ce
here the words are present along the diagonal.
What you can do is just do all the transitions in all 8 direction using recursion and backtracking.
So during recursion if that (i,j) is valid then keep storing it in a current string or vector. And during backtracking keep popping it from that vector.
Also remember to modify the grid[i][j] after visiting that so that you dont revisit it again otherwise there will be a infinite loop.
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.