Skip to content

Commit 53e47de

Browse files
refactor 1339
1 parent d2f502c commit 53e47de

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

src/main/java/com/fishercoder/solutions/_1339.java

-28
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,6 @@
55
import java.util.HashSet;
66
import java.util.Set;
77

8-
/**
9-
* 1339. Maximum Product of Splitted Binary Tree
10-
*
11-
* Given a binary tree root. Split the binary tree into two subtrees by removing 1 edge such that the product of the sums of the subtrees are maximized.
12-
* Since the answer may be too large, return it modulo 10^9 + 7.
13-
*
14-
* Example 1:
15-
* Input: root = [1,2,3,4,5,6]
16-
* Output: 110
17-
* Explanation: Remove the red edge and get 2 binary trees with sum 11 and 10. Their product is 110 (11*10)
18-
*
19-
* Example 2:
20-
* Input: root = [1,null,2,3,4,null,null,5,6]
21-
* Output: 90
22-
* Explanation: Remove the red edge and get 2 binary trees with sum 15 and 6.Their product is 90 (15*6)
23-
*
24-
* Example 3:
25-
* Input: root = [2,3,9,10,7,8,6,5,4,11,1]
26-
* Output: 1025
27-
*
28-
* Example 4:
29-
* Input: root = [1,1]
30-
* Output: 1
31-
*
32-
* Constraints:
33-
* Each tree has at most 50000 nodes and at least 2 nodes.
34-
* Each node's value is between [1, 10000].
35-
* */
368
public class _1339 {
379
public static class Solution1 {
3810
public int maxProduct(TreeNode root) {

0 commit comments

Comments
 (0)