Qualcomm Interview Question

I was asked to do two-sums efficiently.