Check if an N-ary tree is in valid state after adding a new connection.
boolean isValid(Node root, Node n1, Node n2);
Example:
Onsite experience