Skip to content

Commit 58d3ce5

Browse files
authored
Update Solution.java
1 parent 76a5626 commit 58d3ce5

File tree

1 file changed

+0
-5
lines changed
  • src/main/java/g2501_2600/s2538_difference_between_maximum_and_minimum_price_sum

1 file changed

+0
-5
lines changed

src/main/java/g2501_2600/s2538_difference_between_maximum_and_minimum_price_sum/Solution.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public long maxOutput(int n, int[][] edges, int[] price) {
1515
if (n == 1) {
1616
return 0;
1717
}
18-
1918
this.price = price;
2019
tree = new ArrayList[n];
2120
for (int i = 0; i < n; i++) {
@@ -25,11 +24,9 @@ public long maxOutput(int n, int[][] edges, int[] price) {
2524
tree[e[0]].add(e[1]);
2625
tree[e[1]].add(e[0]);
2726
}
28-
2927
visited = new boolean[n];
3028
visited[0] = true;
3129
dfs(0);
32-
3330
return res;
3431
}
3532

@@ -57,7 +54,6 @@ private long[] dfs(int node) {
5754
} else if (sub[0] > s0) {
5855
s0 = sub[0];
5956
}
60-
6157
if (sub[1] >= l1) {
6258
s1 = l1;
6359
l1 = sub[1];
@@ -66,7 +62,6 @@ private long[] dfs(int node) {
6662
s1 = sub[1];
6763
}
6864
}
69-
7065
if (s0 == 0) {
7166
// only one child. case: example 2
7267
res = Math.max(res, Math.max(l0, l1 + price[node]));

0 commit comments

Comments
 (0)