re: AoC Day 2: Inventory Management System VIEW POST

TOP OF THREAD FULL DISCUSSION
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.

code of conduct - report abuse