Skip to content

Commit

Permalink
2015 day 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacerulerwill committed Jan 7, 2025
1 parent 786c78a commit 944f6bc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions puzzles/Y2015/D1/p1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from typing import Any


def puzzle(input: str) -> Any:
floor = 0
for char in input:
if char == "(":
floor += 1
elif char == ")":
floor -= 1
return floor
14 changes: 14 additions & 0 deletions puzzles/Y2015/D1/p2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Any


def puzzle(input: str) -> Any:
floor = 0
position = 0
while floor != -1:
char = input[position]
if char == "(":
floor += 1
elif char == ")":
floor -= 1
position += 1
return position
Empty file added puzzles/Y2015/__init__.py
Empty file.

0 comments on commit 944f6bc

Please sign in to comment.