I have just started coding with Python recently.Now I am trying to recognize how many ways I can move from A to B, whether there is any obstacles in my path or not. For instance, I have such a table:
0 1 0 0 0
1 0 0 0 1
0 0 1 0 0
0 0 0 0 0
As usual, I intend to start from bottom left to reach top right(The zero in the last line and first column is the start and the zero in the first line and last column is the finish point). And I can pass through '0's but not '1's. The output is the number of possible paths. In this example the output is 5.
I will be really pleased if you help me for a bigger table like this:
0 0 0 1 0 1 0
1 0 1 0 0 0 0
0 0 1 0 0 1 0
0 0 0 1 0 0 1
1 0 0 0 0 0 0
0 0 0 0 1 1 1
0 0 0 1 0 1 0
The answer here is 8.
Thanks for your replies. Other solutions are welcomed too.