File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/main/kotlin/g3401_3500/s3435_frequencies_of_shortest_supersequences Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
package g3401_3500.s3435_frequencies_of_shortest_supersequences
2
2
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%)
4
4
5
5
class Solution {
6
6
private fun buildWordMap (words : List <String >): MutableMap <String ?, Boolean ?> {
@@ -109,14 +109,14 @@ class Solution {
109
109
bg : IntArray ,
110
110
ed : IntArray ,
111
111
): Boolean {
112
- val chk: MutableList <Int ? > = ArrayList <Int ? >()
112
+ val chk: MutableList <Int > = ArrayList <Int >()
113
113
for (j in 0 .. 25 ) {
114
114
if (indg[j] == 0 && tans[j] == 1 ) {
115
115
chk.add(j)
116
116
}
117
117
}
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 )
120
120
if (bg[u] == - 1 ) {
121
121
continue
122
122
}
@@ -155,7 +155,7 @@ class Solution {
155
155
return ans
156
156
}
157
157
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 ) }
159
159
val ns: MutableList <Int > = ArrayList <Int >()
160
160
for (i in 0 .. 25 ) {
161
161
if (tans[i] == 1 ) {
You can’t perform that action at this time.
0 commit comments