Clone an Undirected Graph
Given a reference to a node in a connected undirected graph, return a deep copy of the graph. Each node has an integer val and a list of neighbors. The graph may contain cycles.
The cloned graph ...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
