Unique Paths
There is a robot on an m x n grid. The robot starts at the top-left corner of the grid and wants to reach the bottom-right corner.
At any point, the robot can move only in one of two directions:
- Down
- Right
Given the two integers m and n, return the number of possible unique paths that the robot can take to reach the bottom-right corner.
Example 1
Input
m = 3, n = 7Output
28There are 28 distinct ways to move from the top-left corner to the bottom-right corner of a 3 by 7 grid.
Example 2
Input
m = 3, n = 2Output
3From the top-left corner, the robot must make two downward moves and one rightward move, which can be arranged in 3 unique ways.
Constraints
- 1 <= m, n <= 100
- The answer will be less than or equal to 2 * 10^9