#C12460. Unique Paths in a Rectangular Grid
Unique Paths in a Rectangular Grid
Unique Paths in a Rectangular Grid
You are given a rectangular grid with dimensions m × n. Your task is to find the number of unique paths from the top-left corner of the grid to the bottom-right corner, given that you can only move either right or down at any point in time.
The number of unique paths can be computed using the combinatorial formula: $$ \text{paths} = \binom{m+n-2}{m-1} = \frac{(m+n-2)!}{(m-1)!\,(n-1)!} $$ However, you are encouraged to solve the problem using dynamic programming.
Input: Two integers m and n representing the number of rows and columns respectively.
Output: A single integer representing the number of unique paths from the top-left corner to the bottom-right corner of the grid.
inputFormat
The input consists of two space-separated positive integers m and n on a single line, where 1 ≤ m, n ≤ 20.
outputFormat
Output a single integer: the number of unique paths from the top-left corner to the bottom-right corner.
## sample2 2
2