Algorithm to find out if a set contains two number with sum in the same set using a blackbox function
Your question is essentially answered on the Wikipedia page on the 3SUM problem, specifically the part on 3 different arrays.