Goldman Sachs interview question

Leetcode Easy Problem - High Five