I am currently stuck on this problem, it is from a very highly competitive contest and so it is highly difficult as well. Below is the statement:
There are 2 lists of integers with the same length.
Pick an integer from each list and
calculate the absolute value of their sum.
Return the minimum value for the value.
Example: list1 = [1, 2]; list2 = [-2, 3] => result = 0
Explanation : take 2 and -2
Can anyone help?
Problem Source: 2008 Vietnamese National Student Competition ("Kì thi học sinh giỏi quốc gia"), question 1
I know that there is a brute force solution, but I got Time Limit Exceed (TLE), which means this MUST be done with less than $O(n^2)$ time complexity.