File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11 Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 1
1
package com .codedifferently .lesson11 ;
2
2
3
- import java .util .List ;
4
-
5
3
import java .util .ArrayList ;
4
+ import java .util .List ;
6
5
7
6
public class Lesson11 {
8
7
@@ -12,7 +11,8 @@ public class Lesson11 {
12
11
*/
13
12
public int [] getConcatenation (int [] nums ) {
14
13
int [] ans = new int [nums .length + nums .length ];
15
- for (int i = 0 ; i < nums .length ; i ++) {
14
+
15
+ for (int i = 0 ; i < nums .length ; i ++) {
16
16
ans [i ] = nums [i ];
17
17
ans [i + nums .length ] = nums [i ];
18
18
}
@@ -25,14 +25,15 @@ public int[] getConcatenation(int[] nums) {
25
25
*/
26
26
public List <Integer > findWordsContaining (String [] words , char x ) {
27
27
28
- List <Integer > arrayOfIndices = new ArrayList <>(); // Use a List to dynamically store indices
28
+ List <Integer > arrayOfIndices = new ArrayList <>(); // Use a List to dynamically store indices
29
29
30
30
for (int i = 0 ; i < words .length ; i ++) {
31
31
String letter = String .valueOf (x );
32
- if (words [i ].contains (letter )){ // Check if the character is present in the word
32
+
33
+ if (words [i ].contains (letter )) { // Check if the character is present in the word
33
34
arrayOfIndices .add (i ); // Add the index to the list
34
35
}
35
36
}
36
37
return arrayOfIndices ; // Return list
37
38
}
38
- }
39
+ }
You can’t perform that action at this time.
0 commit comments