So I was solving this problem http://www.codechef.com/CODW2012/problems/BPHC03
I know how to check whether a path exists from 1,1 to n,n
My logic uses recursion by making the entry as 1 in maze to block the path from where it just came
This snippet does not produce the exact answer…infact it shows less number of paths as after calculation of each path many entries are made 1 (or blocked) which hinders exploration of paths which might use a part of the previously explored path and some other new path…
I hope you got my point.
Please tell me how I calculate the number of paths.
Yes exactly… So i need to know how to overcome this shortcoming.
I know my code will give an answer less than the expected value because at the end of 1 exploration many vertices in the maze would be turned to 1 thus hindering the next exploration. Please give me a solution to this.