Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Code/C++/rat_in_maze.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ using namespace std;

int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

bool valid(int x,int y,int n)
{
return (x>=0 && x<n && y>=0 && y<n);
}

bool solve(vector<vector<int>>&matrix,int maze[][20],int n,int x,int y)
{
if(x>n || y>n || y<0 || x<0)
Expand Down Expand Up @@ -104,8 +106,8 @@ int main()
0 0 1 1


Time Complexity = O(2^n)
Space Complexity = O(n*n)
where n = size of maze rows and columns
Time Complexity = O(2^n)
Space Complexity = O(n*n)
where n = size of maze rows and columns

*/