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
Solution Comments
Show commentsProblem Recent Solvers52
Suggested Problems
-
473 Solvers
-
Solve the set of simultaneous linear equations
495 Solvers
-
Determine the number of odd integers in a vector
826 Solvers
-
Relative ratio of "1" in binary number
1596 Solvers
-
Flip the vector from right to left
10775 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!
I'm getting different answers.. can u give a more clear explanation?