first we can find sum[i] = summation of the first i elements of the array in
O(n) for each i
if (sum[i]==sum[j]) then the subarray[i,j] is equal to zero
so we can sort the values in sum and see if there is a duplicate value in
sum (overal time of nlogn)
or if the summation of all elements is limited use a mapping array to do the
task (overal time of n+sum[n])

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to