Skip to content

Commit 48c7c3f

Browse files
authored
Update number-of-ways-to-build-sturdy-brick-wall.py
1 parent ec19d6c commit 48c7c3f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Python/number-of-ways-to-build-sturdy-brick-wall.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def backtracking(height, width, bricks, total, mask, lookup, patterns):
2727
adj = [[j for j, r2 in enumerate(patterns) if not (r1 & r2)] for r1 in patterns]
2828
dp = [[1]*len(patterns), [0]*len(patterns)]
2929
for i in xrange(height-1):
30-
for j in xrange(len(patterns)):
31-
dp[(i+1)%2][j] = sum(dp[i%2][k] for k in adj[j]) % MOD
30+
dp[(i+1)%2] = [sum(dp[i%2][k] for k in adj[j]) % MOD for j in xrange(len(patterns))]
3231
return sum(dp[(height-1)%2]) % MOD
3332

3433

0 commit comments

Comments
 (0)