I am not able to figure out the solution

#include
using namespace std;

int c = 0;

bool playerMaze(int a[1000][1000], int sol[][1000], int i, int j, int m, int n)
{
if (i == m & j == n)
{
sol[m][n] = 1;
c++;
cout<<" ";
return true;
}
if (i > m || j > n)
{
return false;
}

sol[i][j] = 1;
bool diag = playerMaze(a, sol, i + 1, j + 1, m, n);
bool left = playerMaze(a, sol, i, j + 1, m, n);
bool down = playerMaze(a, sol, i + 1, j, m, n);

sol[i][j] = 0;

if (left)
{
    cout << "H";
    return true;
}

if (down)
{
    cout << "V";
    return true;
}

if (diag)
{
    cout << "D";
    return true;
}
return false;

}

int main()
{

int n, m;

cin >> m >> n;

int a[1000][1000];

int sol[1000][1000] = {0};

playerMaze(a, sol, 0, 0, m, n);

cout<<endl<<c<<endl;
return 0;
}

your approach is not correct

refer to this code

i hope it helps
if you have any doubt feel free to ask

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.