i = -1, j = -1 //keeps track of longest span i = left index and j = right index

Suppose we have an Array indexed as A[1....n] and B[1....n]

x = n/2 +1 , y= n/2+1 //used to span the arrays x = left and y = right

Asum = A[x]; // sum obtained while spanning array A Bsum = B[y]; // sum obtained while spanning array B

n1=n; n=1; while(n<=n1) { if(Asum == Bsum) { i = x; j = y; } if(n%2==1 && y+1 <= n1) { y++; Asum = Asum + A[y]; Bsum = Bsum + B[y]; } else if (x-1 >=1) { x--; Asum = Asum + A[x]; Bsum = Bsum + B[x]; } n++; }

If i=-1 and j =-1 then no such span

else i,j gives the index values

Takes Ξ(n) time for spanning array and Ξ(n) space for storing arrays

Answer is $C$.