aboutsummaryrefslogtreecommitdiff
path: root/challenge-082/conor-hoekstra/ch-2.bqn
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-082/conor-hoekstra/ch-2.bqn')
-rw-r--r--challenge-082/conor-hoekstra/ch-2.bqn10
1 files changed, 10 insertions, 0 deletions
diff --git a/challenge-082/conor-hoekstra/ch-2.bqn b/challenge-082/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..4056ed6a57
--- /dev/null
+++ b/challenge-082/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,10 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/082-2.bqn
+
+Interleave ← { n𝕊a‿b: n(↑(∾⟜b⊸∾)↓)a }
+IsInterleaved ← { ∨´𝕨⊸≡¨(↕≠⊑𝕩)Interleave¨<𝕩 }
+
+# Tests
+•Show "XXY" IsInterleaved "XY"‿"X" # 1
+•Show "XXXXZY" IsInterleaved "XXY"‿"XXZ" # 1
+•Show "XXY" IsInterleaved "YX"‿"X" # 0