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
-
Select every other element of a vector
36218 Solvers
-
1220 Solvers
-
Read a column of numbers and interpolate missing data
2350 Solvers
-
Change the sign of even index entries of the reversed vector
644 Solvers
-
Convert given decimal number to binary number.
2278 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?