summary refs log tree commit diff stats
path: root/solutions
diff options
context:
space:
mode:
Diffstat (limited to 'solutions')
-rw-r--r--solutions/day6.fs20
1 files changed, 20 insertions, 0 deletions
diff --git a/solutions/day6.fs b/solutions/day6.fs
new file mode 100644
index 0000000..bb83388
--- /dev/null
+++ b/solutions/day6.fs
@@ -0,0 +1,20 @@
+namespace Solutions
+
+module Day6 =
+    open System.IO
+
+    let buf = File.ReadAllText("inputs/day6.txt")
+
+    let rec scan size str index =
+        if String.length str < size then -1
+        else
+            let current = str[..size - 1] |> Set.ofSeq
+            if Set.count current = size then index + size
+            else
+                scan size str[1..] index + 1
+
+    let part1 () =
+        scan 4 buf 0
+
+    let part2 () =
+        scan 14 buf 0
\ No newline at end of file