From 116add27d0d74360c7d4ad26b12d972657e51afa Mon Sep 17 00:00:00 2001 From: Conor Hoekstra <36027403+codereport@users.noreply.github.com> Date: Wed, 22 Dec 2021 01:40:40 -0500 Subject: Update ch-1.bqn --- challenge-088/conor-hoekstra/bqn/ch-1.bqn | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 ⟨⟩ # ⟨⟩ -- cgit