GIven set of nodes, with pointers only to the parent node, return if the set of nodes can form a tree.
Node is of the form -
struct node { node* parent, int val }
Ex
10
1 2
3 4 5 6Input: (6,2), (1,10), (2,10), (3,1), (4,1), (5,2)
Answer: true
Follow up: If the nodes form a tree, return the root of the tree.
Ans: 10