about summary refs log tree commit diff
path: root/day06.rkt
blob: b3df7c329e19e69ec3a57e2d45d82277603622b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#lang racket

(define data (car (file->lines "day06")))

(for/list ([n '(4 14)])
  (for/or ([i (in-range 0 (- (string-length data) n))])
    (and (= n (length (remove-duplicates
                       (string->list (substring data i (+ i n))))))
         (+ i n))))
; 1623
; 3774