In a matrix DP problem for counting paths from top-left to bottom-right (moving only right or down), the recurrence is dp[i][j] = dp[i-1][j] + dp[i][j-1]. What are the base cases?
-
A
dp[0][j] = 1 for all j and dp[i][0] = 1 for all i
-
B
dp[0][0] = 1 and all others start at 0
-
C
dp[i][j] = 0 for all boundary cells
-
D
dp[1][1] = 1 and dp[0][0] = 0