Problem 44066. Number of paths on a 3d grid
This problem is inspired by https://www.mathworks.com/matlabcentral/cody/problems/1483-number-of-paths-on-a-grid, which you might want to solve first.
Consider a 3d grid formed by n vertices vertically down, m vertices horizontally right, l vertices horizontally front. Your starting point is at the top left front vertex. Your destination is the bottom right back vertex. (From one corner to the furthest corner) You are permitted at each vertex to choose to move down, right or back, that is in the direction towards the destination. You are not to move on what constitutes a back step like moving left, up, or front. If you hit the bottom boundary, right boundary, or back boundary, take it to be given that you move along the 2d boundary.
Ex: in a 2x2X2 grid there are 6 ways. (down, right, back), (d,b,r), (r,d,b), (r,b,d), (b,r,d), (b,d,r)
4x3x2 has 60 ways
6x5x4 has 27720 ways
This problem can be solved using dynamic programming but there are other methods too.
Solution Stats
Problem Comments
-
1 Comment
I'm getting different answers.. can u give a more clear explanation?
Solution Comments
Show commentsProblem Recent Solvers47
Suggested Problems
-
2246 Solvers
-
Back to basics 22 - Rotate a matrix
903 Solvers
-
572 Solvers
-
How many rectangles in a grid ?
74 Solvers
-
1906 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!