Hi I dont know why my code is wrong. And instead of counting 6 ways it only counts 3 ways please help!
#include<bits/stdc++.h>
using namespace std;
int c=0;
void PrintMaze(bool a[][3]){
for(int i=0;i<3;++i){
for(int j=0;j<3;++j){
cout << a[i][j] << " ";
}
cout << endl;
}
}
void Solve(bool init[][3],bool a[][3],int i,int j,int n){
if(i==n && j==n){
init[i][j]=1;++c;
PrintMaze(init);cout << endl;
return;
}
if(i>n || j>n)return;
if(a[i][j]==1)return;
init[i][j]=1;
Solve(init,a,i+1,j,n);Solve(init,a,i,j+1,n);
init[i][j]=0;
}
int main()
{
bool a[][3]={{0,0,0},{0,0,0},{0,0,0}};
PrintMaze(a);
bool init[][3]={0};
Solve(init,a,0,0,2);
cout << c << endl;
}