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