@@ -10,26 +10,27 @@ public class Lesson11 {
10
10
* https://leetcode.com/problems/concatenation-of-array
11
11
*/
12
12
public int [] getConcatenation (int [] nums ) {
13
- int [] ans = new int [(nums .length + nums .length )] ;
14
- System .arraycopy (nums , 0 , ans , 0 , nums .length );
15
- System .arraycopy (nums , 0 , ans , nums .length , nums .length );
16
- return ans ;
17
- }
13
+ int [] ans = new int [(nums .length + nums .length )];
14
+ System .arraycopy (nums , 0 , ans , 0 , nums .length );
15
+ System .arraycopy (nums , 0 , ans , nums .length , nums .length );
16
+ return ans ;
17
+ }
18
18
19
19
/**
20
20
* Provide the solution to LeetCode 2942 here:
21
21
* https://leetcode.com/problems/find-words-containing-character/
22
22
*/
23
23
public List <Integer > findWordsContaining (String [] words , char x ) {
24
- List <Integer > num = new ArrayList <>();
25
- for (var i = 0 ; i <words .length ; i ++){
26
- var word = String .valueOf (words [i ]);
27
- for ( var j = 0 ; j < word .length (); j ++){
28
- if (word .contains (String .valueOf (x ))){
29
- num .add (i );
30
- break ;
31
- }
32
- }
24
+ List <Integer > num = new ArrayList <>();
25
+ for (var i = 0 ; i < words .length ; i ++) {
26
+ var word = String .valueOf (words [i ]);
27
+ for (var j = 0 ; j < word .length (); j ++) {
28
+ if (word .contains (String .valueOf (x ))) {
29
+ num .add (i );
30
+ break ;
33
31
}
34
- return num ; }
32
+ }
33
+ }
34
+ return num ;
35
+ }
35
36
}
0 commit comments