Unique Paths

Medium · 2-D Dynamic Programming · Math · Dynamic Programming · Combinatorics

Problem

A robot starts at the top-left of an m x n grid and must reach the bottom-right. It may only move right or down.

Return how many distinct paths exist.

Examples

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

Right-Down-Down, Down-Right-Down, Down-Down-Right.

Constraints

Approaches

Related problems

Start free on Cariara · Coding problems · System design studio

Starting Python
No results yet.

          
↑↓ move ↵ open esc close

Labs

Loading labs…

Run with your own input

Starting Python

Loading Python…