SDE Path

Unique Paths in a Grid

Medium

Unique Paths in a Grid

Count the number of unique paths from top-left to bottom-right of a grid, moving only right or down.

Input format

The first line contains M and N (1–15 each, pairs distinct).

Output format

Print the number of paths from top-left to bottom-right (right/down only).

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
3 2
Expected output
3
Example 2
Input
3 3
Expected output
6