not able to find out where the code goes wrong and not able to clear the testcases
Code working on sample test case but it shows TLE on other testcase
the approach is correct according to me . If someone knows where this code goes wrong ,please modify it.
If destination is reached print the solution matrix .
Else .
a) Mark current cell in solution matrix as 1.
b) Move forward in the horizontal direction and recursively check if this move leads to a solution.
c) If the move chosen in the above step doesn’t lead to a solution then move down and check if this move leads to a solution.
d) If none of the above solutions works then unmark this cell as 0 (BACKTRACK) and return false