Number of paths on a n-dimensional grid - MATLAB Cody - MATLAB Central

Problem 44072. Number of paths on a n-dimensional grid

Difficulty:Rate

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

94.0% Correct | 6.0% Incorrect
Last Solution submitted on Jun 01, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
2
3

Problem Recent Solvers45

Suggested Problems

More from this Author9

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!