Notice that most of the subarrays overlap in some way. In [3, 2, 5, 1]
, [3, 2]
is part of [3, 2, 5]
. It seems there's an opportunity to keep track of just one thing for now.
The final solution has us using a hash map/dict to store previous subarray sums.

