 All Problems
Unique Paths
medium
math
dynamic programming
combinatorics
amazon
google
microsoft

There is a robot on an m x n grid. The robot is initially located at the top-left corner. The robot tries to move to the bottom-right corner. The robot can only move either down or right at any point in time.

Given the two integers m and n, return the number of possible unique paths that the robot can take to reach the bottom-right corner.

Example 1:

Input:
3 7
Output: 28

Example 2:

Input:
3 2
Output: 3

Constraints:

  • 1 ≤ m, n ≤ 100

Input format: Two integers m and n on one line.

Output format: Number of unique paths.

Run to check your code against the sample cases, or submit to run every case