1135. Unique Paths in Grid

EasyDynamic ProgrammingGrid DPCombinatorics

A robot starts at the top-left of an m x n grid and can only move right or down. Return the number of distinct paths to reach the bottom-right corner. The input is JSON {m, n}.

Input: JSON {m, n}.

Output: Integer — the number of unique paths.

Examples

Example 1
Input: {"m":3,"n":7}
Output: 28
Explanation: 28 right/down paths.
Example 2
Input: {"m":3,"n":2}
Output: 3
Explanation: Three paths.
Example 3
Input: {"m":1,"n":1}
Output: 1
Explanation: Single cell.

Constraints

Asked by

TCSInfosysWiproCognizantCapgemini
Solve this problem in the editor →