Goldman Sachs interview question

leet code easy and medium