summary refs log tree commit diff homepage
diff options
context:
space:
mode:
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