Problem 3427 · Easy

Sum of Variable Length Subarrays

For each index, add the subarray that starts nums[i] places earlier (or at the front), and total all of those sums.

Open the interactive visualisation