#K14236. Distinct Paths in a Grid
Distinct Paths in a Grid
Distinct Paths in a Grid
Given an n x n grid, find the number of distinct paths from the top-left corner to the bottom-right corner by moving only to the right or down. This problem can be viewed as computing the binomial coefficient:
$$\binom{2n-2}{n-1} = \frac{(2n-2)!}{((n-1)!)^2}$$
where n
is an integer such that 1 ≤ n ≤ 100
.
inputFormat
The input consists of a single integer n
representing the dimensions of the grid.
outputFormat
Output a single integer which is the number of distinct paths from the top-left corner to the bottom-right corner in the grid.
## sample1
1