Unique Paths - aloalgo

Unique Paths

Medium

You are given a grid with m rows and n columns.

Your task is to calculate the total number of unique paths to reach the bottom-right corner of the grid.

Note that:

  • You start from the top-left corner of the grid.
  • From any position, movement is restricted to either one step down or one step right.

Return the total number of unique paths.

Example 1

Inputs
m = 1
n = 1
Output
1
Explanation:

There is only one cell in the grid, so there is only one unique path.

Example 2

Inputs
m = 2
n = 2
Output
2
Explanation:

There are two unique paths:

  1. Right -> Down
  2. Down -> Right

Example 3

Inputs
m = 2
n = 3
Output
3
Explanation:

The unique paths are

  1. Right -> Right -> Down
  2. Right -> Down -> Right
  3. Down -> Right -> Right
Loading...
Inputs
m = 1
n = 1
Output
1

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!