1506. Find Root of N-Ary Tree

Problem

Given all nodes of an N-ary tree, find and return the value of the root node.

An N-ary tree is described by two arrays of unique positive integers.

parentValues holds the value of every node in the tree, including the root, in arbitrary order. childValues holds the value of every child, flattened across all child lists, so each non-root node contributes exactly one entry. The tree is well formed: exactly one node is not anybody's child, and that node is the root.

Return the value of the root.

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

1506. Find Root of N-Ary Tree

Given all nodes of an N-ary tree, find and return the value of the root node.