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.

Update day07.py

+3 -3
+3 -3
2016/day07.py
··· 22 22 ssl_ips = 0 23 23 24 24 for line in fileinput.input(): 25 - line = line.strip() 25 + runs = re.findall(r'(\w+)', line.strip()) 26 26 27 - sequences = set(re.findall(r'\](\w+)\[?', line)) | set(re.findall(r'\]?(\w+)\[', line)) 28 - hypernets = set(re.findall(r'\[(\w+)\]', line)) 27 + sequences = runs[0::2] 28 + hypernets = runs[1::2] 29 29 30 30 if any(is_abba(s) for s in sequences): 31 31 if not any(is_abba(h) for h in hypernets):