My Advent of Code solutions in Python. kevinyap.ca/2019/12/going-fast-in-advent-of-code/
advent-of-code python
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add all_unique method to utils.py

+5 -2
+1 -2
2017/starter.py
··· 6 6 from collections import Counter, deque, namedtuple # NOQA 7 7 from itertools import count, product, permutations, combinations, combinations_with_replacement # NOQA 8 8 9 - from utils import (parse_line, mul, factors, memoize, primes, new_table, md5, sha256, # NOQA 9 + from utils import (parse_line, mul, all_unique, factors, memoize, primes, new_table, md5, sha256, # NOQA 10 10 Point, DIRS, DIRS_4, DIRS_8) # NOQA 11 11 12 12 # Itertools Functions: ··· 21 21 22 22 for i, line in enumerate(fileinput.input()): 23 23 line = line.strip() 24 - 25 24 data = parse_line(r'', line) 26 25 27 26 if i == 0:
+4
2017/utils.py
··· 36 36 yield l[i:i + n] 37 37 38 38 39 + def all_unique(lst): 40 + return len(lst) == len(set(lst)) 41 + 42 + 39 43 def factors(n): 40 44 """Returns the factors of n.""" 41 45 return sorted(