There doesn't appear to be many algorithm puzzles on this forum, so I thought I would start some and see how they are received.
You are given an n x m matrix/array of 1s and 0s. You are given starting co-ordinates (A,B) and destination co-ordinates (X,Y). Your goal is to find the quickest path to get from start to finish moving 1 square at a time (no diagonals). However, you cannot move onto a square with a 1 in it. Effectively you have to solve a maze. The output should give directions and be something of the form:
Question
Guest
There doesn't appear to be many algorithm puzzles on this forum, so I thought I would start some and see how they are received.
You are given an n x m matrix/array of 1s and 0s. You are given starting co-ordinates (A,B) and destination co-ordinates (X,Y). Your goal is to find the quickest path to get from start to finish moving 1 square at a time (no diagonals). However, you cannot move onto a square with a 1 in it. Effectively you have to solve a maze. The output should give directions and be something of the form:
The most time efficient algorithm will be the winner (credit may also be given to the most memory efficient solution). Good Luck.
Edited by psychic_mindLink to comment
Share on other sites
11 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.