Goldman Sachs interview question

Problems similar to the ones on Hackerrank and LeetCode