Salesforce interview question

Algorithm question: pretty similar to two sum.