N = 3
sum1 = 4
rows, cols = (N+1, sum1+1)
dp = [[-1 for i in range(rows)] for j in range(cols)]
for i in range(0, cols):
dp[0][i] = False
for i in range(0, rows):
dp[i][0] = True
I'm not sure why I'd get a list index out of range exception for this code, the only time it doesnt show an error is when I edit the line "dp[0][i] to dp[0][i-1]" The aim is to have a matrix dp size 3*4 with the first column entirely True and the row 0 to be entirely False except at 0,0 where it is True