Skip to content

Commit 35bce0f

Browse files
committed
Fixed sonar
1 parent ebe0fa5 commit 35bce0f

File tree

1 file changed

+3
-1
lines changed
  • src/main/java/g3301_3400/s3361_shift_distance_between_two_strings

1 file changed

+3
-1
lines changed

src/main/java/g3301_3400/s3361_shift_distance_between_two_strings/Solution.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ public long shiftDistance(String s, String t, int[] nextCost, int[] previousCost
88
long cost;
99
for (int i = 0; i < 26; i++) {
1010
cost = nextCost[i];
11-
for (int j = (i == 25 ? 0 : i + 1); j != i; j++) {
11+
int j = i == 25 ? 0 : i + 1;
12+
while (j != i) {
1213
costs[i][j] = cost;
1314
cost += nextCost[j];
1415
if (j == 25) {
1516
j = -1;
1617
}
18+
j++;
1719
}
1820
}
1921
for (int i = 0; i < 26; i++) {

0 commit comments

Comments
 (0)