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 parse_nums method to utils

+5 -1
+1 -1
2018/starter.py
··· 6 6 from collections import Counter, defaultdict, 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, all_unique, factors, memoize, primes # NOQA 9 + from utils import parse_line, parse_nums, mul, all_unique, factors, memoize, primes # NOQA 10 10 from utils import new_table, transposed, rotated # NOQA 11 11 from utils import md5, sha256, knot_hash # NOQA 12 12 from utils import Point, DIRS, DIRS_4, DIRS_8 # NOQA
+4
2018/utils.py
··· 21 21 return ret 22 22 23 23 24 + def parse_nums(line): 25 + return [int(n) for n in re.findall(r'\d+', line)] 26 + 27 + 24 28 def new_table(val, width, height): 25 29 return [[val for _ in range(width)] for _ in range(height)] 26 30