A robot sits at the top-left corner of an m x n grid and can only move right or down at each step. Return the number of distinct paths from the top-left corner to the bottom-right corner.
m = 3, n = 728m = 3, n = 23Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →The same DP idea as 1-D, but the state depends on two indices — often two positions in a grid, or a position in each of two sequences being compared.
Read the full 2-D Dynamic Programming guide →
Original problem on LeetCode ↗