1490. Clone N-Ary Tree
Problem
Create a deep copy of an N-ary tree.
Given the root of an N-ary tree, create a deep copy (clone) of the tree. Each node in an N-ary tree has a value and a list of children nodes.
The copy should have the same structure and all new nodes with the same values as the original tree.
Examples
Input: []
Output: []
Input: [1,[]]
Output: [1,[]]
Hints
Use recursion to traverse and clone each node.
Create a new node with the same value and recursively clone all children.
Use a hash map to handle cyclic references if needed (though N-ary trees are typically acyclic).
Related Problems
1490. Clone N-Ary Tree
Create a deep copy of an N-ary tree.