Goldman Sachs Interview Question

Questions were asked on DSA (Leetcode easy and mid level) and a easy puzzle.