Brute force will solve this problem, but leetcode will reject because of time limit.
- build two number's sum cache
{ 42 : [index1, index2], ... }
- foreach
key
in cache andsum - key
in cache, add the cartesian product of the values to the result collection