There is a mouse in a room, in the top-left corner. It can move up, down, left, or right, and the mouse cannot go through any cell in the room twice. Given this, return all the possible paths in which the mouse will visit every square.
Input: Two integers m
and n
, which represent the m x n
room. m<9, n<9.
Output: The m x n
room, with ^<>v
noting the direction the path goes. Each line of the room will be seperated by a newline, and each room will be seperated by one newline. The last room the mouse enters will be noted by a dot.
v > v .
v ^ v ^
> ^ > ^
next room goes here...
Test Cases:
Input: 2 3
, output:
v > v
> ^ .
> > v
. < <
v . <
> > ^
Shortest code wins.
v^<
,>>^
then) \$\endgroup\$