Update 2015 solutions

This commit is contained in:
2024-10-20 15:19:25 -04:00
parent 87ab42743e
commit e73fa3bae7
16 changed files with 362 additions and 411 deletions

View File

@@ -1,8 +1,9 @@
from lib import *
from lib import get_data
data = open(0).read()
data = get_data(__file__)
part_2 = True
t = sum((1 if c == "(" else -1 for c in data))
print(t)
floor = 0
for i, c in enumerate(data):
@@ -10,13 +11,6 @@ for i, c in enumerate(data):
floor += 1
elif c == ")":
floor -= 1
else:
print(c)
assert False
if part_2 and floor == -1:
if floor == -1:
print(i + 1)
break
if not part_2:
print(floor)