Skip to content

Commit b1009d6

Browse files
committed
Fixed sonar
1 parent 5238113 commit b1009d6

File tree

1 file changed

+9
-5
lines changed
  • src/main/java/g3501_3600/s3515_shortest_path_in_a_weighted_tree

1 file changed

+9
-5
lines changed

src/main/java/g3501_3600/s3515_shortest_path_in_a_weighted_tree/Solution.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ public int[] treeQueries(int n, int[][] edges, int[][] queries) {
2222
adj[i] = new ArrayList<>();
2323
}
2424
for (int[] e : edges) {
25-
int u = e[0], v = e[1], w = e[2];
25+
int u = e[0];
26+
int v = e[1];
27+
int w = e[2];
2628
adj[u].add(new int[] {v, w});
2729
adj[v].add(new int[] {u, w});
2830
}
@@ -33,11 +35,13 @@ public int[] treeQueries(int n, int[][] edges, int[][] queries) {
3335
depth = new int[n + 1];
3436
edgeWeight = new int[n + 1];
3537
dfs(1, 0, 0);
36-
Fenw fenw = new Fenw(n);
38+
Fen fenw = new Fen(n);
3739
List<Integer> ansList = new ArrayList<>();
3840
for (int[] query : queries) {
3941
if (query[0] == 1) {
40-
int u = query[1], v = query[2], newW = query[3];
42+
int u = query[1];
43+
int v = query[2];
44+
int newW = query[3];
4145
int child;
4246
if (parent[v] == u) {
4347
child = v;
@@ -77,11 +81,11 @@ private void dfs(int node, int par, int dist) {
7781
out[node] = timer;
7882
}
7983

80-
private static class Fenw {
84+
private static class Fen {
8185
int n;
8286
int[] fenw;
8387

84-
public Fenw(int n) {
88+
public Fen(int n) {
8589
this.n = n;
8690
fenw = new int[n + 2];
8791
}

0 commit comments

Comments
 (0)