8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a81f09f commit eb1dca3Copy full SHA for eb1dca3
solutions/Days/Day04.hs
@@ -23,10 +23,10 @@ parseInput = either (error . errorBundlePretty) id . parse pInput ""
23
part1 :: [(Range, Range)] -> Int
24
part1 = length . filter f
25
where
26
- f ((a, b), (c, d)) = (a >= c && b <= d) || (c >= a && d <= b)
+ f ((s1, e1), (s2, e2)) = (s1 >= s2 && e1 <= e2) || (s2 >= s1 && e2 <= e1)
27
28
part2 :: [(Range, Range)] -> Int
29
part2 = length . filter f
30
31
- f ((a, b), (c, d)) = (c >= a && c <= b) || (a >= c && a <= d)
+ f ((s1, e1), (s2, e2)) = s1 <= e2 && s2 <= e1
32
0 commit comments