15 lines
345 B
Racket
15 lines
345 B
Racket
#lang racket
|
|
|
|
;; solution for day 1
|
|
|
|
(module+ main
|
|
(define nums (map string->number (file->lines "inputs/1")))
|
|
|
|
;; part 1
|
|
(for*/first ([a (in-list nums)] [b (in-list nums)] #:when (= 2020 (+ a b)))
|
|
(* a b))
|
|
|
|
;; part 2
|
|
(for*/first ([a (in-list nums)] [b (in-list nums)] [c (in-list nums)] #:when (= 2020 (+ a b c)))
|
|
(* a b c)))
|