Simple 2x2 open grid
Input
[[0,0],[0,0]]
Output
['DR', 'RD']
Two shortest non-revisiting paths: Down->Right and Right->Down. Sorted lexicographically yields ['DR', 'RD'].
Full lesson preview
Use backtracking to discover every valid path from the top-left to the bottom-right of a grid maze.
Problem statement
Task
Examples
Input
[[0,0],[0,0]]
Output
['DR', 'RD']
Two shortest non-revisiting paths: Down->Right and Right->Down. Sorted lexicographically yields ['DR', 'RD'].
Input format
Output format
Constraints
Samples
Input
[[0,1,0],[0,1,0],[0,0,0]]
Output
['DDRR']
Walls force a unique path: Down, Down, Right, Right.