LoopUp interview question

Algorithm question's like two sums from the Leetcode