Given the root of a binary tree, divide the tree into two separate subtrees by removing exactly one edge such that the product of the sums of the values of the two resulting subtrees is maximized.
Return the maximum product of the sums of the two subtrees modulo
Note: You need to maximize the product before taking the modulo operation.
Constraints:
The number of nodes in the tree is in the range
Node.val
Given the root of a binary tree, divide the tree into two separate subtrees by removing exactly one edge such that the product of the sums of the values of the two resulting subtrees is maximized.
Return the maximum product of the sums of the two subtrees modulo
Note: You need to maximize the product before taking the modulo operation.
Constraints:
The number of nodes in the tree is in the range
Node.val