aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-12-26 23:55:45 +0000
committerGitHub <noreply@github.com>2021-12-26 23:55:45 +0000
commitfce4366854a0e426824748346f565c4eab5cbc16 (patch)
tree00ab8fe3013241fa7cd2811350d31b13bfe5e9ec
parent3eda845cf24ca3eabed811f357e4b25d99ee94a3 (diff)
parent116add27d0d74360c7d4ad26b12d972657e51afa (diff)
downloadperlweeklychallenge-club-fce4366854a0e426824748346f565c4eab5cbc16.tar.gz
perlweeklychallenge-club-fce4366854a0e426824748346f565c4eab5cbc16.tar.bz2
perlweeklychallenge-club-fce4366854a0e426824748346f565c4eab5cbc16.zip
Merge pull request #5420 from codereport/master
Additional BQN Solution to Week 88
-rw-r--r--challenge-088/conor-hoekstra/bqn/ch-1.bqn10
1 files changed, 10 insertions, 0 deletions
diff --git a/challenge-088/conor-hoekstra/bqn/ch-1.bqn b/challenge-088/conor-hoekstra/bqn/ch-1.bqn
index 5bdeb4fe6a..b3301e84ee 100644
--- a/challenge-088/conor-hoekstra/bqn/ch-1.bqn
+++ b/challenge-088/conor-hoekstra/bqn/ch-1.bqn
@@ -8,3 +8,13 @@ Solution ← ×´÷⊢
# Tests
Solution 5‿2‿1‿4‿3 # ⟨ 24 60 120 30 40 ⟩
Solution 2‿1‿4‿3 # ⟨ 12 24 6 8 ⟩
+
+# Alternative Solution (that works for 0s)
+
+PreScan ← ×`¯1↓1∾⊢
+ArraryOfProducts ← PreScan⌾⌽ × PreScan
+
+ArraryOfProducts 5‿2‿1‿4‿3 # ⟨ 24 60 120 30 40 ⟩
+ArraryOfProducts 2‿1‿4‿3 # ⟨ 12 24 6 8 ⟩
+ArraryOfProducts 5‿2‿0‿4‿3 # ⟨ 0 0 120 0 0 ⟩
+ArraryOfProducts ⟨⟩ # ⟨⟩