← Back to challenges

Maneuvering in a Cave

JavaScriptHardarrayslogicmath

Instructions

Create a function that returns the count of all possible paths from top left to bottom right of an m * n matrix with the constraints that from each cell you can either move to the right or down.

Examples

calc(2, 2) ➞ 2

calc(3, 3) ➞ 6

calc(4, 4) ➞ 20

Note:

m may not be equal to n.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.