sln_2020_01
Copyright(c) Eric Mertens 2020
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Main

Description

https://adventofcode.com/2020/day/1

Find entries in an expense report that sum up to 2020 and return their product.

Synopsis

Documentation

main :: IO () Source #

>>> :main
494475
267520550

solve Source #

Arguments

:: [Int]

inputs

-> Int

count

-> Int

product

Given a list of integer inputs, find the product of count entries that sum up to 2020.

>>> solve [1721, 979, 366, 299, 675, 1456] 2
514579

| >>> solve [1721, 979, 366, 299, 675, 1456] 3 241861950

solve' Source #

Arguments

:: [Int]

sorted inputs

-> Int

count

-> Int

target sum

-> Int

current product

-> Int

next alternative

-> Int

final product