res of size n with all elements set to 1.i of the node with genetic value 1. If 1 is not in nums, return res as is.children to represent the tree structure.seen array to keep track of visited genetic values.i, perform DFS on its subtree to mark all genetic values in the subtree as seen.miss until a value not seen is found.res[i] to miss.i and repeat steps 6-8 until the root is reached.res array.