It would be more elegant to define the solution for the 1x1 case as 1 rather than 0.
agree, but will leave as so, so as to not affect submitted solutions.
I disagree with the base case. A 1x1 matrix has 1 path. And, the empty matrix has no path (zero).
The first test case has been changed from 0 to 1 without rescoring past solutions.
The first test case is incorrect. The null path (starting and ending at the same place) is a solution. The 1x1 case should have 1 solution.
Project Euler: Problem 9, Pythagorean numbers
282 Solvers
613 Solvers
Create a square matrix of multiples
383 Solvers
122 Solvers
Is this triangle right-angled?
2872 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!