#K10636. Unique Paths in a Grid

    ID: 23291 Type: Default 1000ms 256MiB

Unique Paths in a Grid

Unique Paths in a Grid

You are given an m x n grid. Your task is to compute the number of unique paths from the top-left cell to the bottom-right cell of the grid. You can only move either right or down at any step.

A dynamic programming approach is a common solution. Alternatively, the answer can be computed using the combinatorial formula below:

$$ \text{Number of Paths} = \binom{m+n-2}{m-1} $$

However, in this problem, you are expected to implement the solution using dynamic programming.

inputFormat

The input consists of a single line containing two space-separated integers m and n, where m is the number of rows and n is the number of columns of the grid.

outputFormat

Output a single integer representing the number of unique paths from the top-left corner to the bottom-right corner of the grid.

## sample
2 2
2

</p>