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R
FBFBFBFRRL
BBBFBFFRLR
FBFBFFBLLL
BBFFFFFLRL
BFBFBBBRRL
FBBFFBFLRR
BBBFFFFLRL
BFBBBBBLLR
BBFFFFFLRR
FFFBBFFRLL
BFBFBBFRLL
BFBBBFFLLL
BBFFBBBLRL
BBFBFBFRLL
FFBFFBBRRL
FBFBFBBLLL
BBFFBBBLLR
FFBBFBBRRL
FFFBFFBRLL
BFBFFBBRRL
BBBFFFBRLR
BFBBFFBLRL
FFFBFFBLLR
BFFBFBBLLR
FBFBFBFLLR
BFFBFFFRRL
FBBFFBBLRL
BBFFFBFRRR
FFBFFFFRRR
BFFBFBBRRR
FBFFBBBLRL
BFFFBBFRRR
BBBFFFFRLR
BFBFBFBRLL
FBBFFFFRRL
BBFFBBFRRL
BFBBBFBLLR
FFBFFFBRLR
FFFBBFBRLR
FBFBBBFRRL
BBFFBBFLLR
BBFFBFFRLR
FBBFFBFRRL
FFFBFFFLRR
FFBBBBFRRR

4
day4.rkt

@ -34,7 +34,7 @@
(define (regex/c rx) (curry regexp-match? rx))
(define birth-year/c (regex/c #px"^(19[2-9][0-9]|200[0-2])$"))
(define issue-year/c (regex/c #px"^(201[0-9]|2020)$"))
(define expiration-year/c (regex/c #px"^(202[0-9]|2030)"))
(define expiration-year/c (regex/c #px"^(202[0-9]|2030)$"))
(define (height/c str)
(match str
[(pregexp #px"^([0-9]+)(cm|in)$" (list _ hgt unt))
@ -42,7 +42,7 @@
["cm" (<= 150 (string->number hgt) 193)]
["in" (<= 59 (string->number hgt) 76)])]
[_ #f]))
(define hair-color/c (regex/c #px"#[0-9a-f]{6}"))
(define hair-color/c (regex/c #px"^#[0-9a-f]{6}$"))
(define eye-color/c (regex/c #px"^(amb|blu|brn|gry|grn|hzl|oth)$"))
(define passport-id/c (regex/c #px"^\\d{9}$"))

29
day5.rkt

@ -0,0 +1,29 @@
#lang racket
(require "lib/common.rkt")
(define (pass->id str)
(for/fold ([id 0])
([ch (in-string str)])
(+ (* 2 id)
(case ch
[(#\F #\L) 0]
[(#\B #\R) 1]))))
(define (day5a in)
(apply max (map pass->id in)))
(define (day5b in)
(define ids (map pass->id in))
(first (memf (lambda (id)
(and (not (member id ids))
(member (add1 id) ids)
(member (sub1 id) ids)))
(range (apply min ids)
(apply max ids)))))
(module+ main
(call-with-input-file "data/day5.txt"
(lambda (prt)
(define input (port->lines prt))
(answer 5 1 (day5a input))
(answer 5 2 (day5b input)))))
Loading…
Cancel
Save