Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53e47de

Browse files
refactor 1339
1 parentd2f502c commit53e47de

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

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

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,6 @@
55
importjava.util.HashSet;
66
importjava.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
publicclass_1339 {
379
publicstaticclassSolution1 {
3810
publicintmaxProduct(TreeNoderoot) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp