Skip to content

Commit 2564f02

Browse files
authored
Update strange-printer-ii.py
1 parent 118adad commit 2564f02

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Python/strange-printer-ii.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ def has_cycle(adj, color, lookup):
3131

3232
boxes = collections.defaultdict(lambda:[len(targetGrid), len(targetGrid[0]), -1, -1])
3333
for r, row in enumerate(targetGrid):
34-
for c, v in enumerate(row):
35-
boxes[v][0] = min(boxes[v][0], r)
36-
boxes[v][1] = min(boxes[v][1], c)
37-
boxes[v][2] = max(boxes[v][2], r)
38-
boxes[v][3] = max(boxes[v][3], c)
34+
for c, color in enumerate(row):
35+
boxes[color][0] = min(boxes[color][0], r)
36+
boxes[color][1] = min(boxes[color][1], c)
37+
boxes[color][2] = max(boxes[color][2], r)
38+
boxes[color][3] = max(boxes[color][3], c)
3939
adj = collections.defaultdict(set)
4040
for color, (min_r, min_c, max_r, max_c) in boxes.iteritems():
4141
for r in xrange(min_r, max_r+1):

0 commit comments

Comments
 (0)