about summary refs log tree commit diff
path: root/day01.clj
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-12-02 13:34:36 +0100
committerLeah Neukirchen <leah@vuxu.org>2020-12-02 13:34:36 +0100
commit4fcb892b97f7bbdba4c2a873e4493a00722ef40e (patch)
tree9a4ef2178491784c57aebc7046eedcad1ebc80cc /day01.clj
parent68f50ebf838f4c1e2764d65db5ce606cf101eaf3 (diff)
downloadadventofcode2020-4fcb892b97f7bbdba4c2a873e4493a00722ef40e.tar.gz
adventofcode2020-4fcb892b97f7bbdba4c2a873e4493a00722ef40e.tar.xz
adventofcode2020-4fcb892b97f7bbdba4c2a873e4493a00722ef40e.zip
day01
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