day1
This commit is contained in:
parent
56a5c212bb
commit
8e4decd15f
14
2022/day01/day01.hs
Normal file
14
2022/day01/day01.hs
Normal file
@ -0,0 +1,14 @@
|
||||
import Data.List.Split
|
||||
import Data.List
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
input <- map (map read . lines) <$> splitOn "\n\n" <$> readFile "input"
|
||||
print $ day1a input
|
||||
print $ day1b input
|
||||
|
||||
day1a :: [[Int]] -> Int
|
||||
day1a = maximum . map sum
|
||||
|
||||
day1b :: [[Int]] -> Int
|
||||
day1b = sum . take 3 . reverse . sort . map sum
|
2256
2022/day01/input
Normal file
2256
2022/day01/input
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user