diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-08-26 16:55:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-26 16:55:33 +0100 |
| commit | 3d66985900fee8460b0e41b98676fd6545f28703 (patch) | |
| tree | b7316216e138845b86cd6dc0f21b013867344df8 | |
| parent | 7487d1bc8e5650e9d99bce5d58747f2e07b52497 (diff) | |
| parent | 71b64a26b6b231b9aec8214d2f1fd6bf6d9e6c69 (diff) | |
| download | perlweeklychallenge-club-3d66985900fee8460b0e41b98676fd6545f28703.tar.gz perlweeklychallenge-club-3d66985900fee8460b0e41b98676fd6545f28703.tar.bz2 perlweeklychallenge-club-3d66985900fee8460b0e41b98676fd6545f28703.zip | |
Merge pull request #10705 from codereport/master
:sparkles: Weeks 283 & 284 in BQN
| -rw-r--r-- | challenge-283/conor-hoekstra/ch-1.bqn | 10 | ||||
| -rw-r--r-- | challenge-283/conor-hoekstra/ch-2.bqn | 8 | ||||
| -rw-r--r-- | challenge-284/conor-hoekstra/ch-1.bqn | 10 | ||||
| -rw-r--r-- | challenge-284/conor-hoekstra/ch-2.bqn | 13 |
4 files changed, 41 insertions, 0 deletions
diff --git a/challenge-283/conor-hoekstra/ch-1.bqn b/challenge-283/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..b2d34a6efe --- /dev/null +++ b/challenge-283/conor-hoekstra/ch-1.bqn @@ -0,0 +1,10 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/283-1.bqn + +UniqueNumber ← ⊑·/1=·≠¨⊔ + +# Tests +•Show UniqueNumber ⟨3, 3, 1⟩ # 1 +•Show UniqueNumber ⟨3, 2, 4, 2, 4⟩ # 3 +•Show UniqueNumber ⟨1⟩ # 1 +•Show UniqueNumber ⟨4, 3, 1, 1, 1, 4⟩ # 3 diff --git a/challenge-283/conor-hoekstra/ch-2.bqn b/challenge-283/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..492b67033b --- /dev/null +++ b/challenge-283/conor-hoekstra/ch-2.bqn @@ -0,0 +1,8 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/283-2.bqn + +DigitCountValue ← (+˝(=⌜⟜↕≠))⊸≡ + +# Tests +•Show DigitCountValue ⟨1, 2, 1, 0⟩ # 1 +•Show DigitCountValue ⟨0, 3, 0⟩ # 0 diff --git a/challenge-284/conor-hoekstra/ch-1.bqn b/challenge-284/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..dd7c3cf421 --- /dev/null +++ b/challenge-284/conor-hoekstra/ch-1.bqn @@ -0,0 +1,10 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/284-1.bqn + +LuckyInteger ← ⌈´¯1∾˜⊢(⊢/˜⊢=·+˝=⌜)⍷ + +# Tests +•Show LuckyInteger ⟨2, 2, 3, 4⟩ # 2 +•Show LuckyInteger ⟨1, 2, 2, 3, 3, 3⟩ # 3 +•Show LuckyInteger ⟨1, 1, 1, 3⟩ # -1 + diff --git a/challenge-284/conor-hoekstra/ch-2.bqn b/challenge-284/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..d2288148ba --- /dev/null +++ b/challenge-284/conor-hoekstra/ch-2.bqn @@ -0,0 +1,13 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/284-2.bqn + +RelativeSort ← {(𝕨/˜+˝𝕩=⌜𝕨)∾∧𝕩/˜¬𝕩∊𝕨} # Explicit +RelativeSort2 ← ((+˝=⌜˜)/⊣)∾·∧(¬∊˜)/⊢ # Tacit + +# Tests +•Show ⟨2,1,4,3,5,6⟩ RelativeSort ⟨2,3,9,3,1,4,6,7,2,8,5⟩ # ⟨2,2,1,4,3,3,5,6,7,8,9⟩ +•Show ⟨1,3,2⟩ RelativeSort ⟨3,3,4,6,2,4,2,1,3⟩ # ⟨1,3,3,3,2,2,4,4,6⟩ +•Show ⟨1,0,3,2⟩ RelativeSort ⟨3,0,5,0,2,1,4,1,1⟩ # ⟨1,1,1,0,0,3,2,4,5⟩ +•Show ⟨2,1,4,3,5,6⟩ RelativeSort2 ⟨2,3,9,3,1,4,6,7,2,8,5⟩ # ⟨2,2,1,4,3,3,5,6,7,8,9⟩ +•Show ⟨1,3,2⟩ RelativeSort2 ⟨3,3,4,6,2,4,2,1,3⟩ # ⟨1,3,3,3,2,2,4,4,6⟩ +•Show ⟨1,0,3,2⟩ RelativeSort2 ⟨3,0,5,0,2,1,4,1,1⟩ # ⟨1,1,1,0,0,3,2,4,5⟩ |
