summaryrefslogtreecommitdiff
path: root/2021/1.hs
diff options
context:
space:
mode:
Diffstat (limited to '2021/1.hs')
-rw-r--r--2021/1.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/2021/1.hs b/2021/1.hs
new file mode 100644
index 0000000..84ae3cb
--- /dev/null
+++ b/2021/1.hs
@@ -0,0 +1,12 @@
+module Main where
+
+import Data.List
+
+import Input
+
+
+main :: IO ()
+main = do
+ inp <- map read <$> getInput 1
+ print (sum . map fromEnum . map (> (0::Int)) $ zipWith (-) (tail inp) inp)
+ print (sum . map fromEnum . map (> (0::Int)) . (\x -> zipWith (-) (tail x) x) . map sum . filter ((== 3) . length) . map (take 3) $ tails inp)