Goldman Sachs interview question

Technical Test had a question regarding Graphs in DSA