Clone a Graph
Talk it through out loud with your AI coach.
The problem
- medium
- Pro
Given one node of a connected undirected graph, where each node has a value and a list of neighbours, build a deep copy of the whole graph. Explain how you avoid copying a node twice or looping forever.