Goldman Sachs Interview Question

two sum from leetcode and it was very easy.