← 返回 amazon 的题目列表Unique Paths in a Grid
类型:online_judge
You need to find all possible paths from the top-left corner (0,0) to the bottom-right corner (m-1, n-1) in a 2D grid. You can only move right or down. Write a function num_paths(m, n), where m and n represent the number of rows and columns of the grid, respectively. The function should return an integer indicating the number of all possible paths. Assume that all paths in the grid are unobstructed.
Example
Input: m = 3, n = 7 Output: 28
Constraints
1 <= m, n <= 100
The result is guaranteed to fit in a 32-bit integer.
Example
Input
3 7