Rat In a Maze All Paths
You are given a N*N maze with a rat placed at maze[0][0]. Find and print all paths that rat can follow to reach its destination i.e. maze[N-1][N-1]. Rat can move in any direction ( left, right, up and down).
Value of every cell in the maze can either be 0 or 1. Cells with value 0 are blocked means rat cannot enter into those cells and those with value 1 are open.
Input Format
Output Format :
Note:
Constraints:
0 < N < 11 0 <= Maze[i][j] <=1
Sample Input 1 :
Sample Output 1 :
Sample Output 1 Explanation :
Which is printed from left to right and then top to bottom in one line.
Comments
Post a Comment
Please give us your valuable feedback