Hey there,

So I was solving this problem

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

```
void calc(int maze[100][100],int n,int i,int j)
{
if(i<0 || i>=n || j<0 || j>=n)
return;
if(maze[i][j]==1)
return;
if(i==n-1 && j==n-1)
{
count++;
return;
}
maze[i][j]=1;
calc(maze,n,i+1,j);
calc(maze,n,i-1,j);
calc(maze,n,i,j+1);
calc(maze,n,i,j-1);
return;
}
```

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.

Thanx