Given two arrays of numbers \(a_{1},...,a_{n}\) and \(b_{1},...,b_{n}\) where each number is 0 or 1,
the fastest algorithm to find the largest span(i,j) such that \(a_{i}+a_{i+1}+...+a_{j}=b_{i}+b_{i+1}+.....+b_{j}\) , or report that there is no such span,
- ATakes \(O(3^{n})\) and \(\Omega (2^{n})\) time if hashing is permitted
- BTakes \(O(n^{3})\) and \(\Omega (n^{2.5})\) time in the key comparison model
- CTakes \(\Theta (n)\) time and space
- DTakes \(O(\sqrt{n})\) time only if the sum of the 2n elements is an even number