This solution is outdated. To rescore this solution, sign in.
-
1 Comment
GeeTwo
on 4 Jul 2022
As I commented elsewhere, only 1198 loops are necessary. The longest path in a square array avoiding adjacent squares is a spiral from a corner to a point near the center. (For odd, a deep slalom gives the same answer.) The number of steps is:
odd: (n^2+2n-3)/2
even:(n^2+2n-4)/2
For 48, this is 1198, not 2500.
Suggested Problems
-
Maximum running product for a string of numbers
2213 Solvers
-
Similar Triangles - find the height of the tree
448 Solvers
-
424 Solvers
-
Return unique values without sorting
946 Solvers
-
Find out missing number from a vector of 9 elements
303 Solvers
More from this Author3
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!