Goldman Sachs Interview Question

Technical Test had a question regarding Graphs in DSA