From 6ebc21a3626006c3aa280924ad541745511672b6 Mon Sep 17 00:00:00 2001 From: turnipgod Date: Wed, 2 Dec 2026 16:38:20 -0500 Subject: init commit; days 1 and 2 solutions --- day1/solution.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 day1/solution.sh (limited to 'day1') diff --git a/day1/solution.sh b/day1/solution.sh new file mode 100755 index 0000000..94c763b --- /dev/null +++ b/day1/solution.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +table=$(cat input.txt | sort | uniq -c | sort) + +most=$(tail -n3 <<< "$table") +least=$(head -n3 <<< "$table") + +calc(){ + awk 'BEGIN { p = 1 } { p *= $2 } END { print p }' +} + +calc <<< "$most" +calc <<< "$least" -- cgit v1.2.3