Backtracking step

when base condition is true ,how backtracking step is executed and also i am not able to dry run this code

i think after first base case executed it set always to 1 with ar[m-1][n-1] and for all possible paths is it?

@kingshuk441 hey is question me 4 recursion call hui to once call ka effect dusre call ke ans pr na pde islie hmne backtracking kia,suppose pehli recursion call chli and after recursion call completion base case ke through return hui ye call ab hm wha agye jha se ye call hui fir iske niche ka code that is backtracking chlega aur woh untrue krdega taki baki ki recursion call pr fark na pde,ap ek bar dry run krke dekho ajayega khud smjh ,Do dry run using call stack with function name and parametrs.

ok but in base case why we are returning true ,even returning false code is running same what is the benefit in returning in base case?

and i am also getting confused on which step or which value of i it should be backtrack?

@kingshuk441 hey return true islie krrhe hai kyunki hme last block tk ka path mil gya hai au hm us path ko print bhi krwa skte hai ,also apko backtrack recursion call ke bad krna hai ,just aisa socho ki recursion apko ans lakr dededi jo ki sahi hi hoga aur jaise hi recursion se ans aggya uske bad us recursiion ne kuch change kia hoga visited array me to use unchange bhi krna hai taki dusri recursion call ke lie woh initial starting jaise rhe ,so we backtrack after recursion call .Hope you get it :slight_smile:

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.