A robots walk

“A robot is located at the top-left corner of a 5×5 grid. The robot can move either up, down, left, or right, but can not visit the same spot twice. The robot is trying to reach the bottom-right corner of the grid.” (link)
How many unique paths can the robot walk?

One simple solution is to recursively walk the grid and eliminate as much one-ways as possible.

Solution source codes:
PHP (~0.06s)
Python (~0.05s)
C (~0.002s)
Go (~0.002s)
Node.js (~0.06s) Thanks to Michael Braunbeck
Java (~0.06s)

Hint: Time measurement on Core2Quad Q9400, 8GB RAM

One thought on “A robots walk”

Leave a Reply

Your email address will not be published. Required fields are marked *