aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Hoekstra <codereport@outlook.com>2024-07-29 10:42:36 -0400
committerConor Hoekstra <codereport@outlook.com>2024-07-29 10:42:36 -0400
commite4e381c78bb60a49b4cac93b6c5d69e42759abda (patch)
tree3ddb097ac42fb5ab2fabb8b2bfd0372051533251
parenta2a0393bed0a645143ff47e7c2ef85c67fa16528 (diff)
downloadperlweeklychallenge-club-e4e381c78bb60a49b4cac93b6c5d69e42759abda.tar.gz
perlweeklychallenge-club-e4e381c78bb60a49b4cac93b6c5d69e42759abda.tar.bz2
perlweeklychallenge-club-e4e381c78bb60a49b4cac93b6c5d69e42759abda.zip
:sparkles: Week 280 in BQN
-rw-r--r--challenge-280/conor-hoekstra/ch-1.bqn9
-rw-r--r--challenge-280/conor-hoekstra/ch-2.bqn13
2 files changed, 22 insertions, 0 deletions
diff --git a/challenge-280/conor-hoekstra/ch-1.bqn b/challenge-280/conor-hoekstra/ch-1.bqn
new file mode 100644
index 0000000000..682aded1af
--- /dev/null
+++ b/challenge-280/conor-hoekstra/ch-1.bqn
@@ -0,0 +1,9 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/280-1.bqn
+
+AppearsTwice ← ⊑¬∘∊⊸/
+
+# Tests
+•Show AppearsTwice "acbddbca" # "d"
+•Show AppearsTwice "abccd" # "c"
+•Show AppearsTwice "abcdabbb" # "a"
diff --git a/challenge-280/conor-hoekstra/ch-2.bqn b/challenge-280/conor-hoekstra/ch-2.bqn
new file mode 100644
index 0000000000..24a9fde227
--- /dev/null
+++ b/challenge-280/conor-hoekstra/ch-2.bqn
@@ -0,0 +1,13 @@
+# For up to date code:
+# https://github.com/codereport/bqn-code/blob/main/pwc/280-2.bqn
+
+AsteriskCount ← +´'*'=(¬·≠`'|'=⊢)⊸/ # Solution 1
+AsteriskCount2 ← +´(¬·≠`'|'=⊢)×'*'⊸= # Solution 2
+
+# Tests
+•Show AsteriskCount "p|*e*rl|w**e|*ekly|" # 2
+•Show AsteriskCount "perl" # 0
+•Show AsteriskCount "th|ewe|e**|k|l***ych|alleng|e" # 5
+•Show AsteriskCount2 "p|*e*rl|w**e|*ekly|" # 2
+•Show AsteriskCount2 "perl" # 0
+•Show AsteriskCount2 "th|ewe|e**|k|l***ych|alleng|e" # 5