/62. Unique Paths

62. Unique Paths

Medium
Probability66.6% acceptance

Given two positive integers row_count and column_count representing the dimensions of a grid, compute the number of distinct paths from the cell (0, 0) to the cell (row_count - 1, column_count - 1), where at each step you may move either one cell right or one cell down.

Example 1

Input: row_count=4, column_count=5

Output: 35

Explanation: There are 35 unique paths from (0,0) to (3,4) moving only right or down.

Example 2

Input: row_count=2, column_count=4

Output: 4

Explanation: There are 4 unique paths from (0,0) to (1,3) moving only right or down.

Constraints

  • 1 <= row_count <= 100
  • 1 <= column_count <= 100
  • The result will be less than or equal to 2 * 109
Python (current runtime)

Case 1

Input: row_count=5, column_count=3

Expected: 15

Case 2

Input: row_count=6, column_count=2

Expected: 6

Case 3

Input: row_count=1, column_count=10

Expected: 1

Case 4

Input: row_count=10, column_count=1

Expected: 1