Goldman Sachs Interview Question

LC Hard - Graph problem