Goldman Sachs interview question

Two Leetcode easy questions involving arrays