about summary refs log tree commit diff
path: root/day06.rkt
diff options
context:
space:
mode:
Diffstat (limited to 'day06.rkt')
-rw-r--r--day06.rkt11
1 files changed, 11 insertions, 0 deletions
diff --git a/day06.rkt b/day06.rkt
new file mode 100644
index 0000000..b3df7c3
--- /dev/null
+++ b/day06.rkt
@@ -0,0 +1,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