summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-12-01 00:17:47 -0500
committerJune McEnroe <june@causal.agency>2020-12-01 00:17:55 -0500
commit7fb36ba69063f2152e8b581ce23c9463ce41abc0 (patch)
tree32002aa330c063f4975642b711262da695606d5f
parentSolve day 1 part 1 (diff)
downloadaoc-7fb36ba69063f2152e8b581ce23c9463ce41abc0.tar.gz
aoc-7fb36ba69063f2152e8b581ce23c9463ce41abc0.zip
Solve day 1 part 2
       41.66 real        39.15 user         1.98 sys
Diffstat (limited to '')
-rw-r--r--2020/day01-2.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/2020/day01-2.sh b/2020/day01-2.sh
new file mode 100644
index 0000000..6f26437
--- /dev/null
+++ b/2020/day01-2.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -eu
+entries=$(cat)
+for i in $entries; do
+	for j in $entries; do
+		for k in $entries; do
+			if [ $((i+j+k)) -eq 2020 ]; then
+				echo $((i*j*k))
+				exit
+			fi
+		done
+	done
+done