day 1: shonks
This commit is contained in:
parent
58e8621d5b
commit
8925617afa
|
@ -0,0 +1,14 @@
|
|||
#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)))
|
Loading…
Reference in New Issue