Skip to content

Commit 0a8548e

Browse files
committed
2021 d5: fix typo error in solution code
1 parent 13b5f1e commit 0a8548e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

2021/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -882,13 +882,13 @@ for points in starmap(diag, lines):
882882
Coupling this with `chain()` we can compress the double `for` into a single one:
883883

884884
```python
885-
for p in chain(starmap(horiz, lines)):
885+
for p in chain(*starmap(horiz, lines)):
886886
space[p] += 1
887887

888888
overlapping = sum(x > 1 for x in space.values())
889889
print('Part 1:' overlapping)
890890

891-
for p in chain(starmap(diag, lines)):
891+
for p in chain(*starmap(diag, lines)):
892892
space[p] += 1
893893

894894
overlapping = sum(x > 1 for x in space.values())

2021/solutions/day05.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ def diag(ax, ay, bx, by):
3333
bx, by = map(int, b.split(','))
3434
lines.append((ax, ay, bx, by))
3535

36-
for p in chain(starmap(horiz, lines)):
36+
for p in chain(*starmap(horiz, lines)):
3737
space[p] += 1
3838

3939
overlapping = sum(x > 1 for x in space.values())
4040
advent.print_answer(1, overlapping)
4141

4242

43-
for p in chain(starmap(diag, lines)):
43+
for p in chain(*starmap(diag, lines)):
4444
space[p] += 1
4545

4646
overlapping = sum(x > 1 for x in space.values())

0 commit comments

Comments
 (0)