From 5a41c4c6aa148af716daa77da381bbc318a4a032 Mon Sep 17 00:00:00 2001 From: sterni Date: Mon, 5 Dec 2022 17:19:16 +0100 Subject: feat(sterni/aoc/2022): day04 BQN solution Very tired today, but seems like a decently tidy solution. Change-Id: Id3055159ae99e9b91fcc4b9b41ec7fe5e9a1bc6a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7528 Tested-by: BuildkiteCI Reviewed-by: sterni Autosubmit: sterni --- users/sterni/exercises/aoc/2022/04/4.bqn | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 users/sterni/exercises/aoc/2022/04/4.bqn (limited to 'users/sterni/exercises/aoc') diff --git a/users/sterni/exercises/aoc/2022/04/4.bqn b/users/sterni/exercises/aoc/2022/04/4.bqn new file mode 100644 index 000000000000..0b8f1b4500a9 --- /dev/null +++ b/users/sterni/exercises/aoc/2022/04/4.bqn @@ -0,0 +1,11 @@ +⟨SplitOn, ReadDec⟩ ← •Import "../../lib.bqn" + +Sections ← { + a‿b ← ReadDec¨ (<'-') SplitOn 𝕩 + ↕⌾(-⟜a) 1+b +} +i ← ∘‿2⥊Sections¨ ∾(<',') SplitOn¨ •FLines "input" +Is ← ∊´∘((⍋≠¨)⊏⊢) + +•Out "day04.1: "∾•Fmt +´(∧´Is)˘ i +•Out "day04.2: "∾•Fmt +´(∨´Is)˘ i -- cgit 1.4.1