three first days on first try!
This commit is contained in:
6
d01/part1.py
Normal file
6
d01/part1.py
Normal 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
10
d01/part2.py
Normal 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
|
Reference in New Issue
Block a user