Skip to content

Commit

Permalink
Completed part 2 of day 3 of year 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
fschatbot committed Dec 10, 2023
1 parent 109dc42 commit ee42c46
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions 2022/3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

split_data = True
completed = 1
completed = True
raw_data = None # Not To be touched

def part1(data):
Expand All @@ -16,4 +16,10 @@ def part1(data):
return acc

def part2(data):
...
acc = 0
for i in range(0, len(data), 3):
group = data[i:i+3]
commons = set(group[0]).intersection(group[1]).intersection(group[2])
common = list(commons)[0]
acc += 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.index(common) + 1
return acc

0 comments on commit ee42c46

Please sign in to comment.