@Lucifer: a very good counter example involving the -ve numbers..[:)] I never thought of negative numbers while looking for solution.
And I don't see a O(N) solution for this --> 1) Find the first pair (i,j) such that: sum( A[0] .. till A[i]) = sum(B[0] ... B[i]) -- ESP when there are -ve numbers, If No negative numbers its same as one provided before. And, sorting the sums & comparing them like you suggested leads us to O(n^2 log n) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/4DoZ5nKZd5wJ. 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.