Amazon Interview Question

Graph Question - convert the graph to a tree (medium)