Maximum Disjoint Subtree Product | HackerRank

Find the maximum possible product of the sums of the weights of two disjoint subtrees.