Groww | Online Round | SDE3 | Print Unique Paths
Anonymous User
817

Please suggest optimal solution for this problem.

For the given 2D Matrix,need to reach at the bottom of the matrix[m,n] from starting index [0.0],can take one step in right & down direction.
Print the kth path which is sorted among all the possible paths

Input -  m = 3, n = 2,k=2
Explanation: From the top-left corner, there are a total of 3 paths to reach the bottom-right corner:
1. Right -> Down -> Down
2. Down -> Down -> Right
3. Down -> Right -> Down

Output (String format) - k =2 ,so second sorted path among above list
Down -> Rigth -> Right
Comments (1)