Goldman Sachs interview question

two leetcode easy-medium coding problems