about summary refs log tree commit diff
path: root/day07.bqn
diff options
context:
space:
mode:
Diffstat (limited to 'day07.bqn')
-rw-r--r--day07.bqn9
1 files changed, 9 insertions, 0 deletions
diff --git a/day07.bqn b/day07.bqn
new file mode 100644
index 0000000..a140450
--- /dev/null
+++ b/day07.bqn
@@ -0,0 +1,9 @@
+d← •BQN '⟨'⊸∾ ∾⟜'⟩' •FChars"day07"
+
+# Brute force O(n^2)
+•Out ⌊´+˝|d -⌜ ↕≠d
+•Out ⌊´+˝(÷⟜2×1⊸+)|d-⌜↕≠d
+
+# More efficient
+•Out +´|d-((≠d)÷2) ⊑ ∧d
+•Out ⌊´+´˘(÷⟜2×1⊸+)|d -⌜˜ (⌊≍⌈) (+´ ÷ ≠)d