diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2024-09-20 23:35:22 -0400 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2024-09-20 23:35:22 -0400 |
| commit | f5e94e61241e2fdf881635f0aee9a49db72e9d26 (patch) | |
| tree | 81c3fe391c7b6aa4dd825f7a8c1665f48b298ba9 | |
| parent | 8cd710f7d2cf43e4997b1f5ac84ddfbdff798ac3 (diff) | |
| download | perlweeklychallenge-club-f5e94e61241e2fdf881635f0aee9a49db72e9d26.tar.gz perlweeklychallenge-club-f5e94e61241e2fdf881635f0aee9a49db72e9d26.tar.bz2 perlweeklychallenge-club-f5e94e61241e2fdf881635f0aee9a49db72e9d26.zip | |
:sparkles: Week 78 & 82 in BQN
| -rw-r--r-- | challenge-078/conor-hoekstra/ch-1.bqn | 8 | ||||
| -rw-r--r-- | challenge-078/conor-hoekstra/ch-2.bqn | 17 | ||||
| -rw-r--r-- | challenge-082/conor-hoekstra/ch-1.bqn | 9 | ||||
| -rw-r--r-- | challenge-082/conor-hoekstra/ch-2.bqn | 10 |
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 |
