File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11 Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -9,14 +9,33 @@ public class Lesson11 {
99 * https://leetcode.com/problems/concatenation-of-array
1010 */
1111 public int [] getConcatenation (int [] nums ) {
12- return null ;
12+ int n = nums .length ;
13+ int [] ans = new int [2 * n ];
14+
15+ for (int i = 0 ; i < n ; i ++) {
16+ ans [i ] = nums [i ];
17+ ans [i + n ] = nums [i ];
18+ }
19+
20+ return ans ;
1321 }
1422
1523 /**
1624 * Provide the solution to LeetCode 2942 here:
1725 * https://leetcode.com/problems/find-words-containing-character/
1826 */
1927 public List <Integer > findWordsContaining (String [] words , char x ) {
20- return null ;
21- }
28+ List <Integer > result = new ArrayList <>();
29+
30+ for (int i = 0 ; i < words .length ; i ++) {
31+ if (words [i ].indexOf (x ) != -1 ) {
32+ result .add (i );
33+ }
34+ }
35+
36+ return result ;
37+ }
2238}
39+
40+
41+
Original file line number Diff line number Diff line change 1+
You can’t perform that action at this time.
0 commit comments