about summary refs log tree commit diff
path: root/day03.bqn
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2021-12-04 00:24:24 +0100
committerLeah Neukirchen <leah@vuxu.org>2021-12-04 00:24:24 +0100
commita1225c26d757405def591f4d9ddc1c5eabcfeef9 (patch)
treea32fc7ff39449e5ae227d4deff31091d4f4c17e2 /day03.bqn
parent278956ae9652193a2231614b533417eefb1523cb (diff)
downloadadventofcode2021-a1225c26d757405def591f4d9ddc1c5eabcfeef9.tar.gz
adventofcode2021-a1225c26d757405def591f4d9ddc1c5eabcfeef9.tar.xz
adventofcode2021-a1225c26d757405def591f4d9ddc1c5eabcfeef9.zip
day03
Diffstat (limited to 'day03.bqn')
-rw-r--r--day03.bqn7
1 files changed, 7 insertions, 0 deletions
diff --git a/day03.bqn b/day03.bqn
new file mode 100644
index 0000000..b68d8e2
--- /dev/null
+++ b/day03.bqn
@@ -0,0 +1,7 @@
+d←'0'-˜•FLines"day03"
+Dec←(2⊸×+⊣)´∘⌽
+
+•Out (2×+´⍉d)(≤×○Dec>)≠d
+
+_part2 ← { 1=≠𝕩 ? ⊑𝕩 ; (𝕨+1) 𝕊 𝕩/˜ =⟜(+´ 𝔽 ÷⟜2∘≠) 𝕨 ⊑¨ 𝕩 }
+•Out (0 ≥_part2 d) ×○Dec (0 <_part2 d)