- In the above code for Rat in a maze problem, when we are at (m,n) position of matrix, we make its value =1 but when we try for the other path, backtracking does not make its value=0(which it does for all other cells but not for cell(m,n) )
- I want to turn this code to a void function, how can I do it?
Doubts in Rat in a Maze Problem
hello @sahilkhan2312000131
cell (m,n) is ur base case i.e if u have reached there then it means u have already found one path.
but if u want to reinitialise it then simple put its value=0 just above the retutrn statement.
do u want to print all routes ? if yes then simply replace bool with void .
remve all return statements