State

dp[i][j] = # paths to reach (i,j).

Advertisement

State

dp[i][j] = # paths to reach (i,j).

Advertisement

Transition

dp[i][j] = dp[i-1][j] + dp[i][j-1]. Came from up OR left.

Base cases

First row + first column all = 1 (only one way).