MEX on Trees Codechef Solution Consider a tree with NN nodes, rooted at node 11.
The value of the ithith node (1≤i≤N)(1≤i≤N) is denoted by AiAi. Chef defines the function MEX(u,v)MEX(u,v) as follows:
Let BB denote the set of all the values of nodes that lie in the shortest path from…