2015/day01: Complete!
ci/woodpecker/push/woodpecker Pipeline was successful Details

main
earnest ma 2023-05-07 19:01:38 -04:00
parent 4489f9da18
commit 3a240d8a9a
Signed by: earnest ma
GPG Key ID: A343F43342EB6E2A
3 changed files with 34 additions and 0 deletions

1
2015/README.md Normal file
View File

@ -0,0 +1 @@
# Advent of Code, 2015 (in 2023, for fun)

32
2015/day01.py Normal file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env python3
from typing import TextIO
f = open("day01.txt", "r")
floors = f.read().strip()
def part1() -> int:
return 0 + floors.count("(") - floors.count(")")
def part2() -> int:
position = 1
current = 0
for a in floors:
if a == "(":
current += 1
else:
current -= 1
if current == -1:
return position
position += 1
if __name__ == "__main__":
print(part1())
print(part2())

1
2015/day01.txt Normal file

File diff suppressed because one or more lines are too long