diff --git a/VERSION b/VERSION index 42ef938..ad028bc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2024.5.1.1 \ No newline at end of file +2024.5.1.2 \ No newline at end of file diff --git a/src/AdventOfCode/Year2024/Day02.hs b/src/AdventOfCode/Year2024/Day02.hs index fcd3ec9..b945e58 100644 --- a/src/AdventOfCode/Year2024/Day02.hs +++ b/src/AdventOfCode/Year2024/Day02.hs @@ -29,7 +29,6 @@ example = ] isSafe :: [Integer] -> Bool -isSafe xs = all (== head signs) (tail signs) && all (inRange (1, 3) . abs) diffs +isSafe xs = any (all (inRange (1, 3))) [diffs, negate <$> diffs] where - diffs = zipWith (-) (tail xs) xs - signs = map signum diffs + diffs = zipWith subtract xs (tail xs)