aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-078/conor-hoekstra/ch-1.bqn8
-rw-r--r--challenge-078/conor-hoekstra/ch-2.bqn17
-rw-r--r--challenge-082/conor-hoekstra/ch-1.bqn9
-rw-r--r--challenge-082/conor-hoekstra/ch-2.bqn10
4 files changed, 44 insertions, 0 deletions
diff --git a/challenge-078/conor-hoekstra/ch-1.bqn b/challenge-078/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..54f55bf3f4
--- /dev/null
+++ b/challenge-078/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,8 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/078-1.bqn
+
+LeaderElement ← ⍷⌈`⌾⌽
+
+# Tests
+•Show LeaderElement ⟨9, 10, 7, 5, 6, 1⟩ # ⟨10, 7, 6, 1⟩
+•Show LeaderElement ⟨3, 4, 5⟩ # ⟨5⟩
diff --git a/challenge-078/conor-hoekstra/ch-2.bqn b/challenge-078/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..7848e90a68
--- /dev/null
+++ b/challenge-078/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,17 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/078-2.bqn
+
+LeftRotate ← >⌽¨⟜<
+
+# Tests
+
+•Show ⟨3,4⟩ LeftRotate ⟨10,20,30,40,50⟩
+# Output:
+# [40 50 10 20 30]
+# [50 10 20 30 40]
+
+•Show ⟨1,3,4⟩ LeftRotate ⟨7,4,2,6,3⟩
+# Output:
+# [4 2 6 3 7]
+# [6 3 7 4 2]
+# [3 7 4 2 6]
diff --git a/challenge-082/conor-hoekstra/ch-1.bqn b/challenge-082/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..3f605e9c0a
--- /dev/null
+++ b/challenge-082/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,9 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/082-1.bqn
+
+Factors ← (1+↕)(⊣/˜0=|)⊢
+CommonFactors ← (∊/⊣)○Factors
+
+# Tests
+•Show 12 CommonFactors 18
+•Show 18 CommonFactors 23
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