diff --git a/2022/3.py b/2022/3.py index 0221dd3..ec54f92 100644 --- a/2022/3.py +++ b/2022/3.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- split_data = True -completed = 1 +completed = True raw_data = None # Not To be touched def part1(data): @@ -16,4 +16,10 @@ def part1(data): return acc def part2(data): - ... \ No newline at end of file + 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 \ No newline at end of file