Skip to content

Commit 10a44dd

Browse files
authored
Merge branch 'main' into main
2 parents 95f1c9c + 0bad77f commit 10a44dd

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

solution/3000-3099/3008.Find Beautiful Indices in the Given Array II/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ public class Solution {
154154
}
155155

156156
if (j == M) {
157-
result.add(i - j); // Pattern found at index i-j+1 (If you have to return 1 Based indexing, that's why added + 1)
157+
result.add(i - j); // Pattern found at index i-j+1 (If you have to return 1 Based
158+
// indexing, that's why added + 1)
158159
j = lps[j - 1];
159160
} else if (i < N && pat.charAt(j) != txt.charAt(i)) {
160161
if (j != 0) {
@@ -196,11 +197,13 @@ public class Solution {
196197
for (int i : i_indices) {
197198

198199
int left_limit = Math.max(0, i - k); // To avoid out of bound -> I used max(0, i-k)
199-
int right_limit = Math.min(n - 1, i + k); // To avoid out of bound -> I used min(n-1, i+k)
200+
int right_limit
201+
= Math.min(n - 1, i + k); // To avoid out of bound -> I used min(n-1, i+k)
200202

201203
int lowerBoundIndex = lowerBound(j_indices, left_limit);
202204

203-
if (lowerBoundIndex < j_indices.size() && j_indices.get(lowerBoundIndex) <= right_limit) {
205+
if (lowerBoundIndex < j_indices.size()
206+
&& j_indices.get(lowerBoundIndex) <= right_limit) {
204207
result.add(i);
205208
}
206209
}

solution/3000-3099/3008.Find Beautiful Indices in the Given Array II/README_EN.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ public class Solution {
152152
}
153153

154154
if (j == M) {
155-
result.add(i - j); // Pattern found at index i-j+1 (If you have to return 1 Based indexing, that's why added + 1)
155+
result.add(i - j); // Pattern found at index i-j+1 (If you have to return 1 Based
156+
// indexing, that's why added + 1)
156157
j = lps[j - 1];
157158
} else if (i < N && pat.charAt(j) != txt.charAt(i)) {
158159
if (j != 0) {
@@ -194,11 +195,13 @@ public class Solution {
194195
for (int i : i_indices) {
195196

196197
int left_limit = Math.max(0, i - k); // To avoid out of bound -> I used max(0, i-k)
197-
int right_limit = Math.min(n - 1, i + k); // To avoid out of bound -> I used min(n-1, i+k)
198+
int right_limit
199+
= Math.min(n - 1, i + k); // To avoid out of bound -> I used min(n-1, i+k)
198200

199201
int lowerBoundIndex = lowerBound(j_indices, left_limit);
200202

201-
if (lowerBoundIndex < j_indices.size() && j_indices.get(lowerBoundIndex) <= right_limit) {
203+
if (lowerBoundIndex < j_indices.size()
204+
&& j_indices.get(lowerBoundIndex) <= right_limit) {
202205
result.add(i);
203206
}
204207
}

0 commit comments

Comments
 (0)