day 9
This commit is contained in:
parent
edb2602831
commit
311803374b
5
09/1.py
Normal file
5
09/1.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
nums = [int(l) for l in open("input", "r").read().split("\n") if l]
|
||||||
|
msg = nums[25:]
|
||||||
|
withpre = [(n, nums[i:i+25]) for (i, n) in enumerate(msg)]
|
||||||
|
invalid = [n for (n, pre) in withpre if not any([True for x in pre if (n - x) in pre])]
|
||||||
|
print(invalid)
|
5
09/2.py
Normal file
5
09/2.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
nums = [int(l) for l in open("input", "r").read().split("\n") if l]
|
||||||
|
target = 542529149
|
||||||
|
sets = sum([[nums[i:x] for x in range(i+2, len(nums))] for (i, n) in enumerate(nums)], [])
|
||||||
|
valid = [min(s) + max(s) for s in sets if sum(s) == target]
|
||||||
|
print(valid)
|
Loading…
Reference in New Issue
Block a user