Given a reference to a node in a connected undirected graph, return a deep copy (clone) of the graph, where each node holds a value and a list of references to its neighbors.
adjList = [[2,4],[1,3],[2,4],[1,3]]a cloned graph with the same adjacency structureSolve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →A graph models relationships as nodes and edges, which can be directed or undirected, weighted or not. Most graph problems come down to choosing the right traversal — DFS, BFS, or union-find — for what you're trying to find.
Original problem on LeetCode ↗