LoopUp Interview Question

Algorithm question's like two sums from the Leetcode