take aux[] array of same size and store cumulative some at
aux[i]=sum{input[0 to i]}
now if you find any repeated element at index i and j then,
subarray start = i + 1;
subarray end = j

if array contain 0 at index j then,
subarray start = 0;
subarray end = j



On 9/2/12, Puneet Gautam <puneet.nsi...@gmail.com> wrote:
> Given an array of positive and negative integers, we need to find the
> MAX length subarray having sum as ZERO...
>
> Is there a solution less than O(n^2)..?
>
> Please help .. i m stuck at this problem..
>
> Thanks
> Puneet
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

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

Reply via email to