mirror of
https://github.com/Xevion/advent-of-code.git
synced 2025-12-06 15:14:21 -06:00
2015 day 1 part 1 & 2
This commit is contained in:
1
2015/day-1/input
Normal file
1
2015/day-1/input
Normal file
File diff suppressed because one or more lines are too long
14
2015/day-1/python/main.py
Normal file
14
2015/day-1/python/main.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
PATH = os.path.join(sys.path[0], '..', 'input')
|
||||
DATA = open(PATH).read()
|
||||
|
||||
print(DATA.count('(') - DATA.count(')'))
|
||||
|
||||
level = 0
|
||||
for i, char in enumerate(DATA):
|
||||
level += 1 if char == '(' else -1
|
||||
if level == -1:
|
||||
print(i + 1)
|
||||
break
|
||||
Reference in New Issue
Block a user