File tree 1 file changed +0
-46
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-46
lines changed Original file line number Diff line number Diff line change 5
5
import java .util .HashMap ;
6
6
import java .util .Map ;
7
7
8
- /**
9
- * 663. Equal Tree Partition
10
- *
11
- * Given a binary tree with n nodes,
12
- * your task is to check if it's possible to partition the tree to two trees which have the equal sum of values
13
- * after removing exactly one edge on the original tree.
14
-
15
- Example 1:
16
- Input:
17
- 5
18
- / \
19
- 10 10
20
- / \
21
- 2 3
22
-
23
- Output: True
24
- Explanation:
25
- 5
26
- /
27
- 10
28
-
29
- Sum: 15
30
-
31
- 10
32
- / \
33
- 2 3
34
-
35
- Sum: 15
36
-
37
-
38
- Example 2:
39
- Input:
40
- 1
41
- / \
42
- 2 10
43
- / \
44
- 2 20
45
-
46
- Output: False
47
- Explanation: You can't split the tree into two trees with equal sum after removing exactly one edge on the tree.
48
-
49
- Note:
50
- The range of tree node value is in the range of [-100000, 100000].
51
- 1 <= n <= 10000
52
-
53
- */
54
8
public class _663 {
55
9
public static class Solution1 {
56
10
/**
You can’t perform that action at this time.
0 commit comments