Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dvanhorn
Created December 5, 2020 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvanhorn/041cc728d28dcf0ffaa55b91782dace3 to your computer and use it in GitHub Desktop.
Save dvanhorn/041cc728d28dcf0ffaa55b91782dace3 to your computer and use it in GitHub Desktop.
Advent of Code, Day 5, Part II
#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