three first days on first try!

This commit is contained in:
2023-12-01 10:42:13 +01:00
commit ca06c26658
6 changed files with 99 additions and 0 deletions

6
d01/part1.py Normal file
View File

@@ -0,0 +1,6 @@
import sys
s = sys.stdin.read()[:-1]
print(sum(map(lambda c: [-1,1][c=='('],s)))

10
d01/part2.py Normal file
View File

@@ -0,0 +1,10 @@
import sys
s = sys.stdin.read()[:-1]
f = 0
for i,c in enumerate(s):
f += -1 if c == ')' else 1
if f == -1:
print(i+1)
break