Unique Paths

Medium

Topics
MathDynamic ProgrammingCombinatorics

A robot sits at the top-left of an m x n grid and can only move right or down. Return the number of distinct paths to the bottom-right corner.

Example 1

Input:  m = 3, n = 7
Output: 28

Example 2

Input:  m = 3, n = 2
Output: 3

Constraints

  • 1 <= m, n <= 100
Run ⌘' · Submit ⌘⏎