Goldman Sachs Interview Question

lc style questions as normal