File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11 Expand file tree Collapse file tree 1 file changed +20
-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 .ArrayList ;
3
4
import java .util .List ;
4
5
5
6
public class Lesson11 {
6
7
7
- /**
8
- * Provide the solution to LeetCode 1929 here:
9
- * https://leetcode.com/problems/concatenation-of-array
10
- */
11
8
public int [] getConcatenation (int [] nums ) {
12
- return null ;
9
+ int n = nums .length ;
10
+ int [] results = new int [2 * n ];
11
+ for (int i = 0 ; i < n ; i ++) {
12
+ results [i ] = nums [i ];
13
+ results [i + n ] = nums [i ];
14
+ }
15
+ return results ;
13
16
}
14
17
18
+ // lookiing for an integer array that has a concatenation method Im going to given the paramters
19
+ // of integer array of variable named nums
20
+ // We are declaring one of the variable which is n which equals num.length.
21
+
15
22
/**
16
23
* Provide the solution to LeetCode 2942 here:
17
24
* https://leetcode.com/problems/find-words-containing-character/
18
25
*/
19
26
public List <Integer > findWordsContaining (String [] words , char x ) {
20
- return null ;
27
+ List <Integer > indices = new ArrayList <>();
28
+ // The new array lists is the result of the place of the indices
29
+ for (int i = 0 ; i < words .length ; i ++) {
30
+ if (words [i ].indexOf (x ) != -1 ) {
31
+ indices .add (i );
32
+ }
33
+ }
34
+ return indices ;
21
35
}
22
36
}
You can’t perform that action at this time.
0 commit comments