I attempted BEERUS with this approach, please tell me if this approach is wrong and how should i attempt it.
Using the property A|B + A&B = A+B , I store the sum of input array elements into array t;
Now each element of t is $ t[i] = (\sum_{i=1}^{n} node_i) + n.node_i$
Thus at $ sum = \sum_i^n t_i = n(\sum_{i=1}^{n} node_i)+ n(node_1 + node_2 + ... ) = 2n(\sum_{i=1}^{n} node_i) $
Therefore $ (\sum_{i=1}^{n} node_i) = sum/2n $
Which makes $ node_i = (t[i]-sum/2n)/n $
Now we have to find the maximum spanning tree. Since the weight of an edge is A&B + A|B = A+B
Therefore maximum path will be to go $max(node)->secondmax(node)$ and so on
Hence I found of maximum spanning tree to be $(2\sum_i^nnode_i) - min(node) - max(node)$
Thank you