Tip 1 : Do some projects.
Tip 2 : Practice dynamic programming.
Tip 1 : Keep it short.
Tip 2 : Do not put false things on resume.
Timing was late evening. Platform was good.


The maze may contain self-cycles.
arr[i] = -1 means the ‘i’th cell doesn’t have an exit.



Here, sorted paths mean that the expected output should be in alphabetical order.
Given a square matrix of size 4*4 (i.e. here 'N' = 4):
1 0 0 0
1 1 0 0
1 1 0 0
0 1 1 1
Expected Output:
DDRDRR DRDDRR
i.e. Path-1: DDRDRR and Path-2: DRDDRR
The rat can reach the destination at (3, 3) from (0, 0) by two paths, i.e. DRDDRR and DDRDRR when printed in sorted order, we get DDRDRR DRDDRR.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?