From faba8123fea6f386a9f1654056c3693e5acd521f Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 1 Dec 2022 06:14:45 +0100 Subject: Add 2022 day 1 solutions --- 2022/01/puzzle-1.awk | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 2022/01/puzzle-1.awk (limited to '2022/01/puzzle-1.awk') 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 } -- cgit v1.2.3