In my humble opinion, If there is no this restriction, some guys may fall into struggle with how to combine those arrays which is not the main meat of this problem. Let's assume the lengths of A,B,C,D are a,b,c,d, we should compute those three possible combination: max(ab, cd), max(ac, bd), max(ad, bc) at the beginning. For example, a=10000,b=10000,c=10,d=10. the time complex will be 10000x10000 if you choose max(ab, cd) while 10000x10 if you choose max(ac, bd).

@aaa45190 I posted a detailed analysis with proof for generic list sizes. It is a lot trickier if all 4 lists have different sizes, but the goal is to always balance time costs between building hashmap and loop-up for sum matching. Basically, it involves how to minimum function

@lvjianchun You are right, but there are more than 2+2 split. We could build hashmap with only a single list or 3 lists as well depending on their list sizes. If 4 sizes are a <= b <= c <= d, actually there will be exactly two splits (ad, bc) or (abc, d) being the candidates for optimal time complexity. (Note: it could be abc <= d)