diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-10-20 19:26:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-20 19:26:49 +0100 |
| commit | 45d7a3475623e0a5ab8e1e8f3b1fb53832f62977 (patch) | |
| tree | 54b5f051122f03f71f76693cac45f7c37a5c9ddb | |
| parent | e2b83219bfeb59434deaff6ca47d29f89cde9cc6 (diff) | |
| parent | fda609a8e8806c401568d5a53918e963a2c8c53f (diff) | |
| download | perlweeklychallenge-club-45d7a3475623e0a5ab8e1e8f3b1fb53832f62977.tar.gz perlweeklychallenge-club-45d7a3475623e0a5ab8e1e8f3b1fb53832f62977.tar.bz2 perlweeklychallenge-club-45d7a3475623e0a5ab8e1e8f3b1fb53832f62977.zip | |
Merge pull request #12890 from codereport/master
:sparkles: Week 344 in BQN
| -rw-r--r-- | challenge-344/conor-hoekstra/ch-1.bqn | 15 | ||||
| -rw-r--r-- | challenge-344/conor-hoekstra/ch-2.bqn | 14 |
2 files changed, 29 insertions, 0 deletions
diff --git a/challenge-344/conor-hoekstra/ch-1.bqn b/challenge-344/conor-hoekstra/ch-1.bqn new file mode 100644 index 0000000000..89d9c12c46 --- /dev/null +++ b/challenge-344/conor-hoekstra/ch-1.bqn @@ -0,0 +1,15 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/344-1.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" +b ⇐ •Import "/home/cph/bqn-code/lib/binary.bqn" + +FromDigits ← { +´𝕩×⌽10⋆↕≠𝕩 } +ArrayFormCompute ← b.Digits+⟜FromDigits + +# Tests +u.UnitTest ( 12 ArrayFormCompute ⟨1, 2, 3, 4⟩) ≡ ⟨1, 2, 4, 6⟩ +u.UnitTest ( 181 ArrayFormCompute ⟨2, 7, 4⟩) ≡ ⟨4, 5, 5⟩ +u.UnitTest ( 1 ArrayFormCompute ⟨9, 9, 9⟩) ≡ ⟨1, 0, 0, 0⟩ +u.UnitTest (9999 ArrayFormCompute ⟨1, 0, 0, 0, 0⟩) ≡ ⟨1, 9, 9, 9, 9⟩ +u.UnitTest (1000 ArrayFormCompute ⟨0⟩) ≡ ⟨1, 0, 0, 0⟩ diff --git a/challenge-344/conor-hoekstra/ch-2.bqn b/challenge-344/conor-hoekstra/ch-2.bqn new file mode 100644 index 0000000000..f104129e4f --- /dev/null +++ b/challenge-344/conor-hoekstra/ch-2.bqn @@ -0,0 +1,14 @@ +# For up to date code: +# https://github.com/codereport/bqn-code/blob/main/pwc/344-2.bqn + +u ⇐ •Import "/home/cph/bqn-test/test.bqn" +fn ⇐ •Import "/home/cph/bqn-code/lib/fun.bqn" + +ArrayFormation ← { ∨´𝕨⊸≡∘∾˘fn.Permutations𝕩 } + +# Tests +u.UnitTest ( ⟨1, 2, 3, 4⟩ ArrayFormation ⟨⟨2,3⟩, ⟨1⟩, ⟨4⟩⟩) ≡ 1 +u.UnitTest ( ⟨1, 2, 3, 4⟩ ArrayFormation ⟨⟨1,3⟩, ⟨2,4⟩⟩) ≡ 0 +u.UnitTest (⟨5, 8, 2, 9, 1⟩ ArrayFormation ⟨⟨9,1⟩, ⟨5,8⟩, ⟨2⟩⟩) ≡ 1 +u.UnitTest ( ⟨1, 2, 3⟩ ArrayFormation ⟨⟨1⟩, ⟨3⟩⟩) ≡ 0 +u.UnitTest ( ⟨7, 4, 6⟩ ArrayFormation ⟨⟨7,4,6⟩⟩) ≡ 1 |
