Skip to content

Commit bd52b29

Browse files
refactor 1273
1 parent b8e8777 commit bd52b29

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

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

-26
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,6 @@
22

33
import java.util.Arrays;
44

5-
/**
6-
* 1273. Delete Tree Nodes
7-
*
8-
* A tree rooted at node 0 is given as follows:
9-
* The number of nodes is nodes;
10-
* The value of the i-th node is value[i];
11-
* The parent of the i-th node is parent[i].
12-
* Remove every subtree whose sum of values of nodes is zero.
13-
* After doing so, return the number of nodes remaining in the tree.
14-
*
15-
* Example 1:
16-
* 0 (1)
17-
* / \
18-
* (-2) 1 2 (4)
19-
* / / | \
20-
* (0)3 (-2)4 (-1)5 6(-1)
21-
*
22-
* Input: nodes = 7, parent = [-1,0,0,1,2,2,2], value = [1,-2,4,0,-2,-1,-1]
23-
* Output: 2
24-
*
25-
* Constraints:
26-
* 1 <= nodes <= 10^4
27-
* -10^5 <= value[i] <= 10^5
28-
* parent.length == nodes
29-
* parent[0] == -1 which indicates that 0 is the root.
30-
* */
315
public class _1273 {
326
public static class Solution1 {
337
public int deleteTreeNodes(int nodes, int[] parent, int[] value) {

0 commit comments

Comments
 (0)