Find Root of N-Ary Tree

You are given a list of N-ary tree nodes where each node has a value and references to its children. Every non-root node appears in the parent list and also appears as a child of exactly one other node. The root appears only in the parent list, never as a child.

You are given two arrays: parentValues containing all node values, and childValues containing all child values flattened from every node's children list. Find the root value using constant extra space.

Examples
Input: [[1,2,3,4],[2,3,4]]
Output: 1
Hints

Find Root of N-Ary Tree

You are given a list of N-ary tree nodes where each node has a value and references to its children. Every non-root node appears in the parent list and also appears as a child of exactly one other node. The root appears only in the parent list, never as a child.