LeetCode 62 Unique Paths - Problem Statement

The problem

A robot starts at the top-left corner of an m × n grid and wants to reach the bottom-right corner. It can only move right or down.

How many unique paths exist?

With m = 3, n = 7:

  • Grid is 3 rows × 7 columns.
  • Robot needs 2 down moves and 6 right moves in some order.
  • Answer: 2828.

With m = 3, n = 2:

  • RRD, RDR, DRR... wait, that's wrong. Actually RD, DR (only 1 right, 2 downs? No.)
  • m=3m=3 means 3 rows (2 down moves), n=2n=2 means 2 columns (1 right move).
  • Paths: DR, RD, DR... = 33 paths.

Constraints: 1m,n1001 \le m, n \le 100.