Skip to content

Commit 998c38d

Browse files
committed
Fixed sonar
1 parent 7987a8a commit 998c38d

File tree

1 file changed

+5
-5
lines changed
  • src/main/kotlin/g3401_3500/s3435_frequencies_of_shortest_supersequences

1 file changed

+5
-5
lines changed

src/main/kotlin/g3401_3500/s3435_frequencies_of_shortest_supersequences/Solution.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package g3401_3500.s3435_frequencies_of_shortest_supersequences
22

3-
// #Hard #2025_01_26_Time_427_(100.00%)_Space_52.78_(100.00%)
3+
// #Hard #2025_01_26_Time_385_(100.00%)_Space_54.41_(100.00%)
44

55
class Solution {
66
private fun buildWordMap(words: List<String>): MutableMap<String?, Boolean?> {
@@ -109,14 +109,14 @@ class Solution {
109109
bg: IntArray,
110110
ed: IntArray,
111111
): Boolean {
112-
val chk: MutableList<Int?> = ArrayList<Int?>()
112+
val chk: MutableList<Int> = ArrayList<Int>()
113113
for (j in 0..25) {
114114
if (indg[j] == 0 && tans[j] == 1) {
115115
chk.add(j)
116116
}
117117
}
118-
while (!chk.isEmpty()) {
119-
val u: Int = chk.removeAt(chk.size - 1)!!
118+
while (chk.isNotEmpty()) {
119+
val u: Int = chk.removeAt(chk.size - 1)
120120
if (bg[u] == -1) {
121121
continue
122122
}
@@ -155,7 +155,7 @@ class Solution {
155155
return ans
156156
}
157157
val gm = findMinimalSolutions(wtc, tans, bg, ed)
158-
val minb = gm.stream().mapToInt { i: Int? -> Integer.bitCount(i!!) }.min().getAsInt()
158+
val minb = gm.minOf { Integer.bitCount(it) }
159159
val ns: MutableList<Int> = ArrayList<Int>()
160160
for (i in 0..25) {
161161
if (tans[i] == 1) {

0 commit comments

Comments
 (0)