Cody

Problem 44066. Number of paths on a 3d grid

Created by Jihye Sofia Seo in Community

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

90.0% Correct | 10.0% Incorrect
Last solution submitted on Feb 17, 2019