|
|
|
@ -5,7 +5,6 @@ import re # regex |
|
|
|
|
|
|
|
|
|
nums = list(map(int, get_input(9).splitlines())) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def checkValid(nums, numsum): |
|
|
|
|
for num1 in nums: |
|
|
|
|
for num2 in nums: |
|
|
|
@ -22,8 +21,7 @@ def checkIfNumValid( amble, index ): |
|
|
|
|
return sumnumbers, numsum2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
amble = 25 # NOTE: CHANGE ME TO 25 |
|
|
|
|
invalid, invalidindex = None, None |
|
|
|
|
amble, invalid, invalidindex = 25, None, None |
|
|
|
|
|
|
|
|
|
for i in range(len(nums)): |
|
|
|
|
if(i > amble-1): |
|
|
|
@ -32,8 +30,7 @@ for i in range(len(nums)): |
|
|
|
|
invalid, invalidindex = valid[1], i |
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
stop = False |
|
|
|
|
foundnums = [] |
|
|
|
|
stop, foundnums = False, [] |
|
|
|
|
for i in range(len(nums)): |
|
|
|
|
for rangei in range(len(nums)): |
|
|
|
|
numlist = nums[i-rangei:i] |
|
|
|
@ -47,9 +44,7 @@ for i in range(len(nums)): |
|
|
|
|
if(stop): |
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
minnum = min(foundnums) |
|
|
|
|
maxnum = max(foundnums) |
|
|
|
|
|
|
|
|
|
minnum, maxnum = min(foundnums), max(foundnums) |
|
|
|
|
|
|
|
|
|
print("Part1:", invalid) |
|
|
|
|
print("Part2:", minnum + maxnum) |
|
|
|
|