mirror of
https://github.com/ershisan99/advent-of-code.git
synced 2025-12-16 20:49:24 +00:00
2015 day 1
This commit is contained in:
1
2015/day-1/input.txt
Normal file
1
2015/day-1/input.txt
Normal file
File diff suppressed because one or more lines are too long
8
2015/day-1/part-1.py
Normal file
8
2015/day-1/part-1.py
Normal file
@@ -0,0 +1,8 @@
|
||||
input = open("input.txt").read()
|
||||
count = 0
|
||||
for i, char in enumerate(list(input), start=1):
|
||||
if char == "(":
|
||||
count += 1
|
||||
else:
|
||||
count -= 1
|
||||
print(count)
|
||||
10
2015/day-1/part-2.py
Normal file
10
2015/day-1/part-2.py
Normal file
@@ -0,0 +1,10 @@
|
||||
input = open("input.txt").read()
|
||||
count = 0
|
||||
for i, char in enumerate(list(input), start=1):
|
||||
if char == "(":
|
||||
count += 1
|
||||
else:
|
||||
if count == 0:
|
||||
print(i)
|
||||
break
|
||||
count -= 1
|
||||
Reference in New Issue
Block a user