Skip to content

Commit 05a6bd7

Browse files
committed
FEATURE: Concatenate & word indexes.
1 parent 522243b commit 05a6bd7

File tree

1 file changed

+6
-3
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+6
-3
lines changed

lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public int[] getConcatenation(int[] nums) {
2020
}
2121

2222
// Same thing as the last one, but with the starting position being on whatever index n is on.
23-
// In this case, it's starting at index 3, aka, position 4. This is where the concatenation part happens.
23+
// In this case, it's starting at index 3, aka, position 4. This is where the concatenation part
24+
// happens.
2425
for (int i = 0; i < n; i++) {
2526
ans[i + n] = nums[i];
2627
}
@@ -38,8 +39,10 @@ public List<Integer> findWordsContaining(String[] words, char x) {
3839
List<Integer> result = new ArrayList<>();
3940

4041
// Iterating through the array.
41-
for (int i = 0; i < words.length; i++) {
42-
if (words[i].indexOf(x) != -1) { // If a particular index contains x, and it does not strictly equal -1 (aka, an index that doesn't exist)...
42+
for (int i = 0; i < words.length; i++) {
43+
if (words[i].indexOf(x)
44+
!= -1) { // If a particular index contains x, and it does not strictly equal -1 (aka, an
45+
// index that doesn't exist)...
4346
result.add(i); // Then append the index at the end of the list.
4447
}
4548
}

0 commit comments

Comments
 (0)