Sum of Product 1
For an array $A$ of length $N$, let $F(A)$ denote the sum of the product of all the subarrays of $A$. Formally, $$ F(A) = \sum_{L=1}^N \sum_{R=L}^N \left (\prod_{i=L}^R A_i\right ) $$ For example, let $A = [1, 0, 1]$, then there are $6$ possible subarrays: - Subarray $[1, 1]$ has product $= 1$ - Subarray $[1, 2]$ has product $= 0$ - Subarray $[1, 3]$ has product $= 0$ - Subarray $[2, 2]$ has pr
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start