advent-of-code/2020/day1/day1.hs

12 lines
317 B
Haskell
Raw Normal View History

2020-12-05 09:53:27 +01:00
import AoC
2020-12-02 10:12:00 +01:00
import Data.List
import Data.Maybe
import Control.Monad
find_n_summing :: (Num a, Eq a) => a -> Int -> [a] -> Maybe [a]
find_n_summing to = (find ((to ==) . sum) .) . replicateM
2020-12-05 09:53:27 +01:00
main = runAoC (fmap read <$> lines) (solution 2) (solution 3)
where solution = product . fromJust .: find_n_summing 2020