Skip to content

Commit f0b50f3

Browse files
committed
Fixed sonar
1 parent d6961d2 commit f0b50f3

File tree

2 files changed

+6
-6
lines changed
  • src/main/kotlin/g3301_3400
    • s3303_find_the_occurrence_of_first_almost_equal_substring
    • s3306_count_of_substrings_containing_every_vowel_and_k_consonants_ii

2 files changed

+6
-6
lines changed

src/main/kotlin/g3301_3400/s3303_find_the_occurrence_of_first_almost_equal_substring/Solution.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class Solution {
1515
f2[ch.code - 'a'.code]++
1616
}
1717
while (right < n) {
18-
val ch = s.get(right)
18+
val ch = s[right]
1919
f1[ch.code - 'a'.code]++
2020
if (right - left + 1 == pattern.length + 1) {
21-
f1[s.get(left).code - 'a'.code]--
21+
f1[s[left].code - 'a'.code]--
2222
left += 1
2323
}
2424
if (right - left + 1 == pattern.length && check(f1, f2, left, s, pattern)) {

src/main/kotlin/g3301_3400/s3306_count_of_substrings_containing_every_vowel_and_k_consonants_ii/Solution.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class Solution {
2727
val map: MutableMap<Char?, Int?> = HashMap<Char?, Int?>()
2828
var res: Long = 0
2929
while (end < word.length) {
30-
val ch = word.get(end)
30+
val ch = word[end]
3131
// adding vowel or consonants;
3232
if (vowels.contains(ch)) {
3333
if (map.containsKey(ch)) {
34-
map.put(ch, map.get(ch)!! + 1)
34+
map.put(ch, map[ch]!! + 1)
3535
} else {
3636
map.put(ch, 1)
3737
}
@@ -41,9 +41,9 @@ class Solution {
4141
// checking any valid string ispresent or not
4242
while (map.size == 5 && consonants >= k) {
4343
res += (word.length - end).toLong()
44-
val ch1 = word.get(start)
44+
val ch1 = word[start]
4545
if (vowels.contains(ch1)) {
46-
val temp = map.get(ch1)!! - 1
46+
val temp = map[ch1]!! - 1
4747
if (temp == 0) {
4848
map.remove(ch1)
4949
} else {

0 commit comments

Comments
 (0)