Complete Post: https://tutorialhorizon.com/algorithm...
Objective: Given an array write an algorithm to find the sum of all the possible sub-arrays.
Example:
int [] a = {1, 2, 3};
Output: Possible subarrays –
{1}, {2}, {3}, {1, 2} , {2, 3}, {1, 2, 3}
So sum = 1+ 2+ 3 + 3 + 5 + 6 = 20
#algorithm #array #algo #interview