Your Task:
You don’t need to read input or print anything. Your task is to complete the function is_possible() which takes a square matrix (M) and its size (N) as inputs and returns true if there’s path possible from the source to destination. Else, it returns false. You have to start from the Source, traverse through the blank cells, and reach the Destination. You can move Up, Down, Right and Left. The description of cells is as follows:
A value of cell 1 means Source.
A value of cell 2 means Destination.
A value of cell 3 means Blank cell.
A value of cell 0 means Wall.
Note: There are only a single source and a single destination.
Expected Time Complexity: O(N2).
Expected Auxiliary Space: O(N2).
Example:
Input:
2
4
3 0 0 0 0 3 3 0 0 1 0 3 0 2 3 3
3
0 3 2 3 0 0 1 0 0
Output:
1
0