Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Unique Paths

XPChallenge Points: 20
levelLevel: Medium

A robot starts at the top-left cell of an m x n grid. Its goal is to reach the bottom-right cell of the grid.
At every step, it may only move one cell to the right or one cell down.

Your task is to determine the total number of unique paths that lead the robot from its starting point to its destination.

You may assume that both m and n are positive integers.
The result will always be less than or equal to 2 × 10⁹.

Example 1:

Input: m = 2, n = 3

Output: 3

Explanation:

Possible paths: 1. Right → Right → Down 2. Right → Down → Right 3. Down → Right → Right

Example 2:

Input: m = 4, n = 4

Output: 20

Explanation:

There are 20 different ways for the robot to reach the bottom-right cell in a 4x4 grid.

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result