Pergunta de entrevista da empresa Goldman Sachs

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