Goldman Sachs interview question

java basic stuff and two medium leetcode