diff options
Diffstat (limited to 'aoc/2022')
-rwxr-xr-x | aoc/2022/01/part-one.sh | 2 | ||||
-rwxr-xr-x | aoc/2022/01/part-two.sh | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/aoc/2022/01/part-one.sh b/aoc/2022/01/part-one.sh new file mode 100755 index 0000000..a0e0095 --- /dev/null +++ b/aoc/2022/01/part-one.sh @@ -0,0 +1,2 @@ +#!/bin/sh +sed 's/$/+/' | { echo 0; sed 's/^+$/p0/'; echo p; } | dc | sort -n | tail -1 diff --git a/aoc/2022/01/part-two.sh b/aoc/2022/01/part-two.sh new file mode 100755 index 0000000..a5a4d77 --- /dev/null +++ b/aoc/2022/01/part-two.sh @@ -0,0 +1,3 @@ +#!/bin/sh +sed 's/$/+/' | { echo 0; sed 's/^+$/p0/'; echo p; } | dc | + sort -n | tail -n 3 | { echo 0; sed 's/$/+/'; echo p; } | dc |