Skip to content

re: AoC Day 2: Inventory Management System VIEW POST

re: Part 1 from collections import Counter with open("input.txt") as f: ids = [Counter(l.strip()) for l in f] count2 = 0 count3 = 0 for c in i...

Nice! Did you implement editdistance yourself, or is that an external library?


It is external. I found it via a quick google search. The edit distance measures how many operations - insertion, deletion or substitution - it takes to get from one string to the other. Since all the strings in the puzzle input have the same length, insertion and deletion do not come into play and it works out perfectly.

Ok that’s cool, just checking. Neat!

code of conduct - report abuse