Replce all 0's with -1 -1 1 -1 -1 1 1 1 1 -1 perform the following operation a[i] = a[i-1] + a[i] for i = 1 to n-1 -1 0 -1 -2 -1 0 1 2 1 consider first element as 0 0 -1 0 -1 -2 -1 0 1 2 1 hash all these values to an array of size 2n+1 as sum will lie between -n to n where for 2 i&j value hash to same place inverval [i,j) will have equal no of 0's and 1's
-- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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.