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 11package 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
55class 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 ) {
You can’t perform that action at this time.
0 commit comments