nice idea..
On Oct 20, 11:04 am, SUMANTH M sumanth.n...@gmail.com wrote:
- Take another sum array which contains sums of original array at each
index, here sum[0] = a[0]; sum[1] = a[0] + a[1]
;...sum[i]=a[0]+a[1]+...a[i];
- Traverse the sum array and search for duplicates.
ex: a[] =
+1 for Sumanth's solution.
On Oct 20, 12:03 pm, anshu mishra anshumishra6...@gmail.com wrote:
index = 0 1 2 3 4 5 6
ar = 0 1 2 -4 -3 6 -3
sumar = 0 1 3 -1 -4 2 -1
first index where we get the number which has already appeared in sumar will
be the last index of sub array whose