Goldman Sachs interview question

Two hackerrank programming challenge questions