Back to course home
0% completed
Vote For New Content
Solution: Clone Graph
Problem Statement
Given a reference of a node in a connected undirected graph, return a deep copy (clone) of the graph. Each node in the graph contains a value (int) and a list (List[Node]) of its neighbors.
Example 1:
Input:
    1--2
    |  |
    4--3
Expected Output:
    1--2
    |  |
    4--3
Explanation: The graph has four nodes with the following connections:
- Node 
1is connected to nodes2and4. - Node 
2is connected to nodes1and3. - Node 
3is connected to nodes2and4. - Node 
4is connected to nodes1and3. 
.....
.....
.....
Like the course? Get enrolled and start learning!