File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11 Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,32 @@ public class Lesson11 {
9
9
* https://leetcode.com/problems/concatenation-of-array
10
10
*/
11
11
public int [] getConcatenation (int [] nums ) {
12
- return null ;
12
+ int [] ans = new int [nums .length + nums .length ];
13
+ for (int i = 0 ; i < nums .length ; i ++) {
14
+ ans [i ] = nums [i ];
15
+ ans [i + nums .length ] = nums [i ];
16
+ }
17
+ return ans ;
13
18
}
14
19
15
20
/**
16
21
* Provide the solution to LeetCode 2942 here:
17
22
* https://leetcode.com/problems/find-words-containing-character/
18
23
*/
19
24
public List <Integer > findWordsContaining (String [] words , char x ) {
20
- return null ;
25
+ int [] indices = new int [words .length ];
26
+ int count = 0 ;
27
+
28
+ for (int i = 0 ; i < words .length ; i ++) {
29
+ if (words [i ].contains (Character .toString (x ))) {
30
+ indices [count ] = i ;
31
+ count = count + 1 ;
32
+ }
33
+ }
34
+ int [] arrayOfIndices = new int [count ];
35
+ for (int i = 0 ; i < count ; i ++) {
36
+ arrayOfIndices .length ;
37
+ }
38
+ return arrayOfIndices .length ;
21
39
}
22
40
}
You can’t perform that action at this time.
0 commit comments