3427. Sum of Variable Length Subarrays
You are given an integer array
nums
of sizen
. For each indexi
where0 <= i < n
, define a subarraynums[start ... i]
wherestart = max(0, i - nums[i])
.Return the total sum of all elements from the subarray defined for each index in the array.
1 | class Solution { |