maximum interval across two arrays

We are given with two arrays A and B..each of size N...elements of array contains either 1 or 0...
we have to find such an interval (p,q)(inclusive) such that the sum of all the elements of A (between this interval) and sum of all elements of B (between this interval ) is equal...
a[p]+a[p+1]....+a[q]= b[p]+b[p+1]....+b[q]


Popular posts from this blog