Skip to content

Commit 7c1af62

Browse files
committed
"feat:adds Lesson11.java for NileJackson"
1 parent 3e8f77b commit 7c1af62

File tree

1 file changed

+31
-1
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+31
-1
lines changed

lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.codedifferently.lesson11;
22

3+
import java.util.ArrayList;
34
import java.util.List;
45

56
public class Lesson11 {
@@ -10,13 +11,42 @@ public class Lesson11 {
1011
*/
1112
public int[] getConcatenation(int[] nums) {
1213
return null;
14+
}
15+
class Solution {
16+
public int[] getConcatenation(int[] nums) {
17+
int answer[] = new int[2 * nums.length];
18+
for(int i = 0; i < nums.length; i ++) {
19+
answer[i]= nums[i];
20+
}
21+
int index = nums.length;
22+
for(int i = 0; i < nums.length; i ++) {
23+
answer[index] = nums[i];
24+
index++;
25+
}
26+
return answer;
27+
}
1328
}
1429

30+
31+
1532
/**
1633
* Provide the solution to LeetCode 2942 here:
1734
* https://leetcode.com/problems/find-words-containing-character/
1835
*/
1936
public List<Integer> findWordsContaining(String[] words, char x) {
37+
2038
return null;
2139
}
22-
}
40+
}
41+
42+
class Solution {
43+
public List<Integer> findWordsContaining(String[] words, char x) {
44+
List<Integer> resultWords = new ArrayList<>();
45+
for (int i = 0; i < words.length; i++) {
46+
if (words[i].indexOf(x) != -1) {
47+
resultWords.add(i);
48+
}
49+
}
50+
return resultWords;
51+
}
52+
}

0 commit comments

Comments
 (0)