← Questions
Clone graph
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Given a node of a connected undirected graph, where each node holds a value and a list of neighbors, return a deep copy of the whole graph: new nodes, the same values and the same edges, with each neighbor list in the same order. The problem may be dressed up in a domain story, so recognize it underneath. Do it with BFS or DFS and a map from original to copy.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
