20
2
The puzzle
- Print 0 if a maze n*m can not be solved
- Print 1 if a maze n*m can be solved (in 1 or more ways)
(so I'm not asking for paths but if it's possible to solve!!!)
Input array(2d):
[[0,0,0,0,0,0,1],[0,0,0,0,0,1,0],[0,0,0,0,1,0,0],[1,0,0,0,0,0,0]]
XXXXXXXXX
XS XX
X X X
X X X
XX FX
XXXXXXXXX
0 = can pass through
1 = can not pass trough
[0][n] is the last block of the first line
[m][0] is the first block of the last line
Rule The start position is 0,0 and the end position is n,m You can only move horizontally and vertically Shortest code wins
Should the input be a string or an array? – apsillers – 2014-12-23T14:36:39.630
whatever is shorter – dwana – 2014-12-23T14:40:10.093
3If there is a 1 (wall) at (n,m) should the code return 0? – trichoplax – 2014-12-23T15:17:46.093
3(Same for a wall at (0,0)?) – Martin Ender – 2014-12-23T15:18:36.047
3You say it's a n×m maze, but your indexing implies that it's an (n+1)×(m+1) maze. – Nick Matteo – 2014-12-23T20:33:52.377
3I am looking forward to the regex solution=) – flawr – 2014-12-23T21:25:42.900