Skip to content

Commit d7e21da

Browse files
committed
chore: rename helper method
1 parent eaa10b8 commit d7e21da

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

_2025/solutions/day03.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def find_max_joltage(self, bank: str, k: int) -> int:
4040
int: Maximum k-digit number that can be formed from the input digits
4141
while preserving their original order
4242
"""
43-
digits = [int(c) for c in bank]
43+
digits = [int(char) for char in bank]
4444
n = len(digits)
4545
remove = n - k
4646
stack: list[int] = []

_2025/solutions/day04.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ class Solution(SolutionBase):
4040
(1, 1), # down-right
4141
]
4242

43-
def find_open_spaces(self, grid: list[list[str]], rows: int, cols: int) -> list[tuple[int, int]]:
43+
def find_accessible_roles(
44+
self, grid: list[list[str]], rows: int, cols: int
45+
) -> list[tuple[int, int]]:
4446
"""Find all accessible paper rolls in the current grid.
4547
4648
An accessible roll is one marked '@' with fewer than four adjacent '@' rolls.
@@ -87,7 +89,7 @@ def part1(self, data: list[str]) -> int:
8789
"""
8890
grid = [list(row) for row in data]
8991
rows, cols = len(grid), len(grid[0])
90-
return len(self.find_open_spaces(grid, rows, cols))
92+
return len(self.find_accessible_roles(grid, rows, cols))
9193

9294
def part2(self, data: list[str]) -> int:
9395
"""Count the total number of rolls that can be removed.
@@ -106,14 +108,14 @@ def part2(self, data: list[str]) -> int:
106108
"""
107109
grid = [list(row) for row in data]
108110
rows, cols = len(grid), len(grid[0])
109-
positions = self.find_open_spaces(grid, rows, cols)
111+
positions = self.find_accessible_roles(grid, rows, cols)
110112

111113
count = 0
112114
while (c := len(positions)) > 0:
113115
count += c
114116
for y, x in positions:
115117
grid[y][x] = "."
116118

117-
positions = self.find_open_spaces(grid, rows, cols)
119+
positions = self.find_accessible_roles(grid, rows, cols)
118120

119121
return count

_2025/tests/test_04.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
solution, ensuring that the implementation meets the expected outputs for
99
given test inputs.
1010
"""
11+
1112
from aoc.models.tester import TestSolutionUtility
1213

14+
1315
def test_day04_part1() -> None:
1416
"""Test the solution for Part 1 of the daily puzzle.
1517
@@ -24,6 +26,7 @@ def test_day04_part1() -> None:
2426
expected=13,
2527
)
2628

29+
2730
def test_day04_part2() -> None:
2831
"""Test the solution for Part 2 of the daily puzzle.
2932

0 commit comments

Comments
 (0)