Pregunta de entrevista de Salesforce

Algorithm question: pretty similar to two sum.