Update Day1.hs

This commit is contained in:
Víctor Martínez 2025-03-11 21:04:24 +01:00 committed by GitHub
commit 0721ec8c1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,7 +22,7 @@ partOne filepath = do
return score return score
where where
-- To calculate the overall score we just need to -- To calculate the overall score we just need to
-- sort the lists and calculate the distances of each element -- sort the lists and calculate the distances between each element
calculateScore (left, right) = calculateScore (left, right) =
sum $ zipWith distance (sort left) (sort right) sum $ zipWith distance (sort left) (sort right)
distance a b = abs (a - b) distance a b = abs (a - b)