Skip to content

Commit e4fcf17

Browse files
authored
Fixed sonar warnings.
1 parent e32aa63 commit e4fcf17

File tree

2 files changed

+4
-4
lines changed
  • src/main/java/g2001_2100

2 files changed

+4
-4
lines changed

src/main/java/g2001_2100/s2045_second_minimum_time_to_reach_destination/Solution.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ private int helper(int pathValue, int time, int change) {
5656
if (i == pathValue - 1) {
5757
break;
5858
}
59-
if ((sum / change) % 2 == 0) {
60-
continue;
59+
if ((sum / change) % 2 != 0) {
60+
sum = (sum / change + 1) * change;
6161
}
62-
sum = (sum / change + 1) * change;
6362
}
6463
return sum;
6564
}

src/main/java/g2001_2100/s2047_number_of_valid_words_in_a_sentence/Solution.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// #Easy #String #2022_05_26_Time_19_ms_(42.57%)_Space_44.9_MB_(37.62%)
44

5+
@SuppressWarnings("java:S135")
56
public class Solution {
67
public int countValidWords(String sentence) {
78
String[] tokens = sentence.split("\\s+");
@@ -10,7 +11,7 @@ public int countValidWords(String sentence) {
1011
int hyphenCount = 0;
1112
int punctuationMarkCount = 0;
1213
boolean valid = true;
13-
if (token.isEmpty() || token.equals("") || token.length() == 0) {
14+
if (token.isEmpty() || token.equals("")) {
1415
continue;
1516
}
1617
for (int i = 0; i < token.length(); i++) {

0 commit comments

Comments
 (0)