Created
December 5, 2020 22:33
-
-
Save dvanhorn/041cc728d28dcf0ffaa55b91782dace3 to your computer and use it in GitHub Desktop.
Advent of Code, Day 5, Part II
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define in "...") | |
(define ss | |
(sort (for/list ([l (in-list (with-input-from-string in port->lines))]) | |
(string->number | |
(string-append "#b" | |
(regexp-replaces l '(("F" "0") | |
("B" "1") | |
("L" "0") | |
("R" "1")))))) | |
<)) | |
(for/first ([s (in-list ss)] | |
[s+1 (in-list (rest ss))] | |
#:when (= (+ s 2) s+1)) | |
(add1 s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment