You are given two integers m and n describing an m x n grid of cells. A path starts at the top-left cell and ends at the bottom-right cell, moving one cell right or one cell down at each step.
Return the number of distinct such paths. The inputs are limited so that the answer is at most 2⋅109.
Examples
Example 1
Input: m = 3, n = 7
Output: 28
Example 2
Input: m = 3, n = 2
Output: 3
Explanation: The three paths are right-down-down, down-down-right, and down-right-down.
Constraints
1≤m, n≤100
The inputs are limited so that the answer is at most 2⋅109.
Loading editor...
Log in to run your code. Your draft is saved in this browser.Log inSign up