Example 1
- Input
- adjList = [[2,4],[1,3],[2,4],[1,3]]
- Output
- [[2,4],[1,3],[2,4],[1,3]]
Create four new nodes and four new neighbour lists. The cycle returns to the same copy 1C, and nodes 2C and 4C share the same copy 3C; matching values alone would not prove a deep copy.