Dodomeki
Sign in

40. Unique Paths

Easy

A person is in the top-left corner of a linhas by colunas grid. At each step, they can only move right or down. Return how many different paths lead to the bottom-right corner.

Example 1
Input: linhas = 3, colunas = 7
Output: 28
Example 2
Input: linhas = 3, colunas = 2
Output: 3
Explanation: The possible moves are down, right, down; right, down, down; or down, down, right.
Constraints
  • 1 <= linhas, colunas <= 20
Dynamic programmingMath
Caso 1
linhas =
3
colunas =
7
Expected =
28
Caso 2
linhas =
3
colunas =
2
Expected =
3

Run checks these 2 cases. Submit runs all 6, including hidden ones.