summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--2018/day01-2.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/2018/day01-2.sh b/2018/day01-2.sh
new file mode 100644
index 0000000..66521fb
--- /dev/null
+++ b/2018/day01-2.sh
@@ -0,0 +1,8 @@
+seq -f "$(cat)" ${1:-150} \
+	| sed 's/^/last/' \
+	| bc \
+	| cat -n \
+	| sort -s -n -k 2 \
+	| uniq -d -f 1 \
+	| sort -b -n \
+	| head -n 1