This problem is inspired by https://www.mathworks.com/matlabcentral/cody/problems/1483-number-of-paths-on-a-grid and https://www.mathworks.com/matlabcentral/cody/problems/44066-number-of-paths-on-a-3d-grid, which you might want to solve first.
Consider n-dimensional grid, and you are moving from one corner to the farthest corner in a minimal number of moves. Each move corresponds to moving to a neighbouring hypercube (among possible up to 2*n neighbours). How many ways are there?
Input format is a row array of size "d" (for d dimension) with number of grid points on each direction.
Optional: can you solve it without loops?
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers52
Suggested Problems
-
1669 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
897 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
14553 Solvers
-
Count consecutive 0's in between values of 1
546 Solvers
-
Find the sides of an isosceles triangle when given its area and height from its base to apex
2247 Solvers
More from this Author9
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!