Skip to content

Commit

Permalink
day 3 part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagowfx committed Dec 3, 2022
1 parent 16bc320 commit 19cf879
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 2022/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Advent of Code 2022 - My Solutions

![Completion Status](https://img.shields.io/badge/stars%20⭐-5/50-yellow)
![Completion Status](https://img.shields.io/badge/stars%20⭐-6/50-yellow)

Santa's reindeer typically eat regular reindeer food, but they need a lot of
magical energy to deliver presents on Christmas. For that, their favorite snack
Expand Down
5 changes: 5 additions & 0 deletions 2022/day3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def main():

total_priority = 0

# Part 1
for line in lines:
c1 = line[:len(line)//2]
c2 = line[len(line)//2:]
Expand All @@ -24,6 +25,10 @@ def main():

print(total_priority)

# Part 2
print(sum([priority(next(iter(set(line1).intersection(line2).intersection(line3))))
for (line1, line2, line3) in zip(lines[::3], lines[1::3], lines[2::3])]))


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions 2022/day3/output.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
7848
2616

0 comments on commit 19cf879

Please sign in to comment.