Skip to content

Commit 2965cd2

Browse files
committed
Fixed sonar
1 parent 7699ae3 commit 2965cd2

File tree

2 files changed

+4
-9
lines changed
  • src/main/java/g3301_3400
    • s3303_find_the_occurrence_of_first_almost_equal_substring
    • s3305_count_of_substrings_containing_every_vowel_and_k_consonants_i

2 files changed

+4
-9
lines changed

src/main/java/g3301_3400/s3303_find_the_occurrence_of_first_almost_equal_substring/Solution.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ public int minStartingIndex(String s, String pattern) {
1919
f1[s.charAt(left) - 'a']--;
2020
left += 1;
2121
}
22-
if (right - left + 1 == pattern.length()) {
23-
if (check(f1, f2, left, right, s, pattern) == true) {
24-
return left;
25-
}
22+
if (right - left + 1 == pattern.length() && check(f1, f2, left, s, pattern)) {
23+
return left;
2624
}
2725
right += 1;
2826
}
2927
return -1;
3028
}
3129

32-
private boolean check(int[] f1, int[] f2, int left, int right, String s, String pattern) {
30+
private boolean check(int[] f1, int[] f2, int left, String s, String pattern) {
3331
int cnt = 0;
3432
for (int i = 0; i < 26; i++) {
3533
if (f1[i] != f2[i]) {

src/main/java/g3301_3400/s3305_count_of_substrings_containing_every_vowel_and_k_consonants_i/Solution.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ public int countOfSubstrings(String word, int k) {
5252
}
5353

5454
private boolean isVowel(char ch) {
55-
if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
56-
return true;
57-
}
58-
return false;
55+
return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
5956
}
6057
}

0 commit comments

Comments
 (0)