Unique Grid Paths
Problem statement
An m by n grid has no blocked cells. Start at the top-left cell and reach the bottom-right cell.
Each move goes one cell right or one cell down. Return the number of different paths. Two paths differ if their sequences of visited cells differ.
When the start and destination are the same cell, the path with no moves counts as one path. Return the exact count as a long.
Function
uniquePaths(m: int, n: int) → longExamples
Example 1
m = 3n = 3return = 6Each path has two right moves and two down moves. Choosing the two right-move positions among four positions gives 6 paths.
Example 2
m = 1n = 4return = 1The only path makes three right moves.
Constraints
1 <= m, n <= 20.