1
0
Fork 0

dry up 2022 day 4

This commit is contained in:
Sloane Perrault 2022-12-04 09:40:05 -05:00
parent 71d604fa14
commit afd4ca3dc3

View file

@ -42,9 +42,11 @@ overlap ((a, b), (c, d))
| d < a = False -- first is fully to the right of second | d < a = False -- first is fully to the right of second
| otherwise = True -- there's some overlap | otherwise = True -- there's some overlap
solve :: Integer -> String -> Integer solve' :: String -> (Row -> Bool) -> Integer
solve 1 input = fromIntegral $ length $ filter fullOverlap $ parse input solve' input predicate = fromIntegral $ length $ filter predicate $ parse input
solve 2 input = fromIntegral $ length $ filter overlap $ parse input solve :: Integer -> String -> Integer
solve 1 input = solve' input fullOverlap
solve 2 input = solve' input overlap
solve _ _ = 0 solve _ _ = 0