diff options
| author | Conor Hoekstra <codereport@outlook.com> | 2024-08-26 10:02:54 -0400 |
|---|---|---|
| committer | Conor Hoekstra <codereport@outlook.com> | 2024-08-26 10:02:54 -0400 |
| commit | fa211fa54e37ad4da511513b1286e0c616e111ce (patch) | |
| tree | 512e52cf5cf446bcb159955183bc8f71e42690c2 | |
| parent | 7487d1bc8e5650e9d99bce5d58747f2e07b52497 (diff) | |
| download | perlweeklychallenge-club-fa211fa54e37ad4da511513b1286e0c616e111ce.tar.gz perlweeklychallenge-club-fa211fa54e37ad4da511513b1286e0c616e111ce.tar.bz2 perlweeklychallenge-club-fa211fa54e37ad4da511513b1286e0c616e111ce.zip | |
:sparkles: Week 284 in BQN
| -rw-r--r-- | challenge-284/conor-hoekstra/ch-1.bqn | 10 | ||||
| -rw-r--r-- | challenge-284/conor-hoekstra/ch-2.bqn | 13 |
2 files changed, 23 insertions, 0 deletions
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⟩ |
