Lenskart | OA | Maze Puzzle / Backtracking & Recursion

image
Given a maze information in form of nXn matrix.Each cell is either blocked or open(-1 for block and 0 for open).You have to start from leftmost-topmost cell A(0,0) and reach to buttom-most and rightmost cell B(n-1,n-1).You are allowed to move from current cell to one cell in right side (i+1,j) or one cell downward(i,j+1).PRINT a path to reach B.

Note :- you cannot move from a blocked cell.
Example -
Input -(No of rows,No of columns,status of each cell(0-> fine,-1-blocked)

4*4

0 0 0 0
0 -1 0 0
-1 0 0 0
0 0 0 0

Output -> (0,0) (0,1) (0,2) (1,2) (2,2) (3,2) (3,3)

Comments (2)