about summary refs log tree commit diff
path: root/day01.clj
diff options
context:
space:
mode:
Diffstat (limited to 'day01.clj')
-rw-r--r--day01.clj15
1 files changed, 15 insertions, 0 deletions
diff --git a/day01.clj b/day01.clj
new file mode 100644
index 0000000..d054ac7
--- /dev/null
+++ b/day01.clj
@@ -0,0 +1,15 @@
+(def data
+  (->> (slurp "day01")
+       (clojure.string/split-lines)
+       (map #(Integer/parseInt %))))
+
+(first (for [a data
+             b data
+             :when (= 2020 (+ a b))]
+         (* a b))) ; => 805731
+
+(first (for [a data
+             b data
+             c data
+             :when (= 2020 (+ a b c))]
+         (* a b c))) ; => 192684960