Replace 0 by -1 and make a[i] as sum of all a[j] j<=i ....  Now u need
to find the subarray with sum 0
For this u can use array of size 2n denoting -n to n
Now at sum u can update array of 2n size with the index just found
corresponding to that sum ....
Overall complexity O(n)

Regards
http://coders-stop.blogspot.com/

On Jan 9, 6:19 pm, bittu <[email protected]> wrote:
> i think its DP Problem....still thinking on the soultion..
>
> @ankur..ur approach nearly matches to mine..what i thought..but we
> need actual solution..

-- 
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