aboutsummaryrefslogtreecommitdiff
path: root/2022/01/puzzle-1.awk
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2022-12-01 06:14:45 +0100
committerThomas Voss <mail@thomasvoss.com> 2022-12-01 06:14:45 +0100
commitfaba8123fea6f386a9f1654056c3693e5acd521f (patch)
treecbe1f66024dd13763b1fe57f420fac198bce28b6 /2022/01/puzzle-1.awk
parentf3e3e3e354b87f4ce27bd74bf14cec05d06974b6 (diff)
Add 2022 day 1 solutions
Diffstat (limited to '2022/01/puzzle-1.awk')
-rwxr-xr-x2022/01/puzzle-1.awk5
1 files changed, 5 insertions, 0 deletions
diff --git a/2022/01/puzzle-1.awk b/2022/01/puzzle-1.awk
new file mode 100755
index 0000000..406a663
--- /dev/null
+++ b/2022/01/puzzle-1.awk
@@ -0,0 +1,5 @@
+#!/usr/bin/awk -f
+
+/[0-9]+/ { acc += $1; next }
+ { if (acc > max) max = acc; acc = 0 }
+END { print max }