Unique Paths
A robot starts at the top-left corner of an m x n grid and wants to reach the bottom-right corner. It can only move either one step right or one step down at any point. Return the number of distinct paths it can take.
Open official problem prompt ↗We want to count, not find, every right/down route across the grid.
Like Pascal's triangle laid flat: the ways to reach a spot are the ways to reach the two spots feeding into it, added together.
- Input
- m = 3, n = 7
- Output
- 28
- Why
- There are 28 distinct right/down routes from the top-left to the bottom-right of a 3x7 grid.
1 <= m, n <= 100The answer is guaranteed to be at most 2 * 10^9.