Skip to content

Commit ec19d6c

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

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ def backtracking(height, width, bricks, total, mask, lookup, patterns):
2424

2525
patterns, lookup = [], set()
2626
backtracking(height, width, bricks, 0, 0, lookup, patterns)
27-
adj = [[] for _ in xrange(len(patterns))]
28-
for i, r1 in enumerate(patterns):
29-
for j, r2 in enumerate(patterns):
30-
if not (r1 & r2):
31-
adj[i].append(j)
27+
adj = [[j for j, r2 in enumerate(patterns) if not (r1 & r2)] for r1 in patterns]
3228
dp = [[1]*len(patterns), [0]*len(patterns)]
3329
for i in xrange(height-1):
3430
for j in xrange(len(patterns)):

0 commit comments

Comments
 (0)