Unique Paths

Medium

A robot starts in the top-left corner of an m × n grid and may only move right or down. Return the number of unique paths to the bottom-right corner.

Example 1

uniquePaths()
Input
m = 3, n = 7
Output
28

Example 2

uniquePaths()
Input
m = 3, n = 2
Output
3
Constraints
1 <= m, n <= 100

Topics

Dynamic ProgrammingMathCombinatorics

Implement uniquePaths in the editor and return the answer — printing it is never graded.