Skip to content

Commit 6877d8b

Browse files
committed
Fixed sonar
1 parent 55736e7 commit 6877d8b

File tree

1 file changed

+3
-7
lines changed
  • src/main/kotlin/g3501_3600/s3515_shortest_path_in_a_weighted_tree

1 file changed

+3
-7
lines changed

src/main/kotlin/g3501_3600/s3515_shortest_path_in_a_weighted_tree/Solution.kt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Solution {
2929
edgeWeight = IntArray(n + 1)
3030
dfs(1, 0, 0)
3131
val fenw = Fen(n)
32-
val ansList: MutableList<Int?> = ArrayList<Int?>()
32+
val ansList: MutableList<Int> = ArrayList<Int>()
3333
for (query in queries) {
3434
if (query[0] == 1) {
3535
val u = query[1]
@@ -54,7 +54,7 @@ class Solution {
5454
}
5555
val answer = IntArray(ansList.size)
5656
for (i in ansList.indices) {
57-
answer[i] = ansList.get(i)!!
57+
answer[i] = ansList[i]
5858
}
5959
return answer
6060
}
@@ -77,11 +77,7 @@ class Solution {
7777
}
7878

7979
private class Fen(var n: Int) {
80-
var fenw: IntArray
81-
82-
init {
83-
fenw = IntArray(n + 2)
84-
}
80+
var fenw: IntArray = IntArray(n + 2)
8581

8682
fun update(i: Int, delta: Int) {
8783
var i = i

0 commit comments

Comments
 (0)