3284. Sum of Consecutive Subarrays
ArrayTwo PointersDynamic Programming
Hints
Hint 1
Think of dynamic programming.
Hint 2
Another approach would be a two-pointer.
Hint 3
Start from the first index and traverse until the last one.
Hint 4
At each step, store the sum of the suffix that forms a consecutive subarray.
Hint 5
Do the above for both +1 and -1 and add them up.
Preparing judge…