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

Commit58d3ce5

Browse files
authored
Update Solution.java
1 parent76a5626 commit58d3ce5

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
return0;
1717
}
18-
1918
this.price =price;
2019
tree =newArrayList[n];
2120
for (inti =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 =newboolean[n];
3028
visited[0] =true;
3129
dfs(0);
32-
3330
returnres;
3431
}
3532

@@ -57,7 +54,6 @@ private long[] dfs(int node) {
5754
}elseif (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)

[8]ページ先頭

©2009-2025 Movatter.jp