Goldman Sachs Interview Question

Some graph dsa problem if I remember.