about summary refs log tree commit diff
path: root/users/sterni/exercises/aoc/2022/01
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-12-01T16·36+0100
committersterni <sternenseemann@systemli.org>2022-12-01T23·50+0000
commit7e122fdcbc266677e83290fef9766f761d99cb9e (patch)
tree12d76275e57d2569f5ae82c6c1a7084b95e4095b /users/sterni/exercises/aoc/2022/01
parent7b87b2ccbb77658617f008306828dd16459fa63a (diff)
feat(sterni/aoc/2022): day01 solutions r/5364
Bonus solution in k as I got sniped by leah2.

Change-Id: I806f5b2ac1388159a427bb239bfb1bb7aeb329d7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7490
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'users/sterni/exercises/aoc/2022/01')
-rw-r--r--users/sterni/exercises/aoc/2022/01/1.bqn7
-rw-r--r--users/sterni/exercises/aoc/2022/01/1.k2
2 files changed, 9 insertions, 0 deletions
diff --git a/users/sterni/exercises/aoc/2022/01/1.bqn b/users/sterni/exercises/aoc/2022/01/1.bqn
new file mode 100644
index 000000000000..f95851e0d93e
--- /dev/null
+++ b/users/sterni/exercises/aoc/2022/01/1.bqn
@@ -0,0 +1,7 @@
+lib ← •Import •path∾"/../../lib.bqn"
+input ← lib.ReadDec¨¨ (<"") lib.SplitOn •FLines •path∾"/input"
+
+cpe ← +´¨ input
+
+•Out "day 01.1: "∾•Fmt ⌈´cpe
+•Out "day 01.2: "∾•Fmt +´3↑∨cpe
diff --git a/users/sterni/exercises/aoc/2022/01/1.k b/users/sterni/exercises/aoc/2022/01/1.k
new file mode 100644
index 000000000000..295503905fb8
--- /dev/null
+++ b/users/sterni/exercises/aoc/2022/01/1.k
@@ -0,0 +1,2 @@
+ / a better approach is to use the downgraded list for both tasks, as demonstrated by leah2
+(|/e),+/e@3#>e:(+/.'1_)'(&0=#'i)_i:0:"input"