I have a n*n
matrix, where each element represents an integer. Starting in [0,0]
I have to find the path of exactly m
elements down to
This Question can be solved using recursion and backtracking. Keep the count of steps covered till now and the cost of path till now.
Here is my implementation https://ideone.com/N6T55p
void fun_me(int arr[4][4], int m, int n,int i,int j,int steps,int cost)
{
//cout<=n || j>=n)
return;
visited[i][j]=1;
if(i==n-1 && steps==m-1)
{
if(maxer