about summary refs log tree commit diff
path: root/day05.clj
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-12-06 15:04:11 +0100
committerLeah Neukirchen <leah@vuxu.org>2020-12-06 15:04:11 +0100
commitad5dd89ea90c3198d41a3b35250b4d8cd7af564d (patch)
tree1432b9660a62021f5f0b44b3fab68d58ca37b5e8 /day05.clj
parenta2037e84ec9dd2ee9ad1528d94a5e4451a0fd41a (diff)
downloadadventofcode2020-ad5dd89ea90c3198d41a3b35250b4d8cd7af564d.tar.gz
adventofcode2020-ad5dd89ea90c3198d41a3b35250b4d8cd7af564d.tar.xz
adventofcode2020-ad5dd89ea90c3198d41a3b35250b4d8cd7af564d.zip
day05
Diffstat (limited to 'day05.clj')
-rw-r--r--day05.clj8
1 files changed, 8 insertions, 0 deletions
diff --git a/day05.clj b/day05.clj
new file mode 100644
index 0000000..f165d11
--- /dev/null
+++ b/day05.clj
@@ -0,0 +1,8 @@
+(def data
+  (->> (slurp "day05")
+       (clojure.string/split-lines)
+       (map (fn [x] (reduce #(+ (* 2 %1) %2)
+                            (map {\F 0, \B 1, \L 0, \R 1} x))))))
+
+(apply max data) ; => 818
+(apply min (remove (set data) (map inc data))) ; => 559