Medium · Dynamic Programming

Unique Paths

Given the number of rows m and columns n of a grid, return how many distinct paths lead from the top-left cell to the bottom-right cell when every move goes one cell right or one cell down.

Examples

Example 1

{
  "m": 3,
  "n": 3
}

Output: 6 paths

Example 2

{
  "m": 3,
  "n": 4
}

Output: 10 paths

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Dynamic Programming problems