This commit is contained in:
Sebastian Seedorf
2020-12-09 11:40:35 +01:00
parent 525c2c91e6
commit 25256f438f
3 changed files with 1048 additions and 0 deletions

16
day09/part1.py Normal file
View File

@@ -0,0 +1,16 @@
from collections import deque
from itertools import combinations
lines = (int(x.strip()) for x in open("input.txt"))
L = 25
buffer = deque(maxlen=L)
result = None
for line in lines:
if len(buffer) == L:
found = any(a + b == line for a, b in combinations(buffer, 2))
if not found:
result = line
break
buffer.append(line)