Rat in a Maze
Medium
Backtracking (Advanced)
A rat starts at the top-left cell of an n x n maze and must reach the bottom-right cell. A cell value of 1 is open and 0 is blocked. The rat may move Down (D), Left (L), Right (R) or Up (U) and may not visit a cell twice on the same path. Print all paths in lexicographic order, one per line, or -1 if there is none.
Constraints
2 <= n <= 8
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.