Goldman Sachs interview question

Two rather easy Coderpad problems, then an option for a third problem.