Number of Unique Paths to Go from Top Left to Bottom Right
A robot starts its journey at the top-left corner of a grid that measures m x n
(m
rows by n
columns).
At each step, the robot has only two possible directions: it can either move to the right or move downward. Its destination is the bottom-right corner of the grid.
Determine the total number of unique paths the robot can take to reach its destination.
Example 1:
Input: m = 2, n = 3
Output: 3
Explanation:
From the top-left corner, there are a total of 3 ways to reach the bottom-right corner:
-
Right -> Right -> Down
-
Right -> Down -> Right
-
Down -> Right -> Right
Example 2:
Input: m = 5, n = 3
Output: 15