You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
aoc-racket/2020/01.rkt

10 lines
290 B
Racket

#lang br
(require racket/file rackunit)
(define (solve combo-length)
(for/first ([c (in-combinations (map string->number (file->lines "01.rktd")) combo-length)]
#:when (eq? 2020 (apply + c)))
(apply * c)))
(check-equal? (solve 2) 1007331)
(check-equal? (solve 3) 48914340)