Medium · Dynamic programming

Unique Paths

You are given the size of a grid: its rows and its columns. A robot starts in the top-left corner and can only move right or down. Return how many different routes reach the bottom-right corner.

  • Both sizes are at least 1.
  • A grid one row or one column wide has exactly one route.
  • The answer fits in an ordinary whole number.
rows = 3
cols = 7

→ 28
Record your take

No one has solved it yet.