-
-
Save tilpner/5231d3b065cc2fdce97b6784c6eebdea to your computer and use it in GitHub Desktop.
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 input (map (compose1 string->number string) | |
(string->list (read-line)))) | |
(define (solve input [offset 1]) | |
(for/sum ([a input] | |
[b (sequence-tail (in-cycle input) offset)] | |
#:when (= a b)) b)) | |
(solve input) | |
(solve input (/ (length input) 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment