Skip to content

Commit b7a8a1e

Browse files
committed
Refactor 2024 day 2
1 parent 3c3a8f4 commit b7a8a1e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/AdventSolutions/Year2024/Day2/Solution2024Day2.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,13 @@ public function solvePart2($input, $debug = false): string
3232
return "Number of safe reports (with dampeners): <info>$safeReports</info>";
3333
}
3434

35-
private function getLevels($line)
35+
private function getLevels($line): array
3636
{
3737
return explode(" ", $line);
3838
}
3939

4040
private function isSafe($levels, $ignoreLevels = 0): bool
4141
{
42-
if (count($levels) < 2) {
43-
return true; // A single level or empty array is trivially safe
44-
}
45-
46-
// Helper function to validate the sequence
4742
$isValid = function ($levels) {
4843
return $this->isValid($levels);
4944
};

0 commit comments

Comments
 (0)