Goldman Sachs interview question

Leetcode Medium Type questions on coderpad