File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
src/main/kotlin/g3301_3400
s3398_smallest_substring_with_identical_characters_i
s3399_smallest_substring_with_identical_characters_ii Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
package g3301_3400.s3398_smallest_substring_with_identical_characters_i
2
2
3
- // #Hard #2024_12_24_Time_1_ms_ (100.00%)_Space_42.9_MB_(39.83 %)
3
+ // #Hard #2024_12_24_Time_2_ms_ (100.00%)_Space_36.4_MB_(92.86 %)
4
4
5
5
class Solution {
6
6
fun minLength (s : String , ops : Int ): Int {
Original file line number Diff line number Diff line change 1
1
package g3301_3400.s3399_smallest_substring_with_identical_characters_ii
2
2
3
- // #Hard #2024_12_24_Time_11_ms_ (100.00%)_Space_45 .7_MB_(54.55 %)
3
+ // #Hard #2024_12_24_Time_22_ms_ (100.00%)_Space_40 .7_MB_(100.00 %)
4
4
5
5
class Solution {
6
6
fun minLength (s : String , numOps : Int ): Int {
7
7
val l = s.length
8
8
var lingyi = 0
9
9
var yiling = 0
10
10
val pq: MutableList <Int > = ArrayList <Int >()
11
- var thisone = s.get( 0 )
11
+ var thisone = s[ 0 ]
12
12
var chang = 1
13
13
if (thisone == ' 0' ) {
14
14
yiling++
15
15
} else {
16
16
lingyi++
17
17
}
18
18
for (i in 1 .. < l) {
19
- val cur = s.get(i)
19
+ val cur = s[i]
20
20
if (cur == thisone) {
21
21
chang++
22
22
} else {
You can’t perform that action at this time.
0 commit comments