Skip to content

Commit 7fa9655

Browse files
author
Meiko-S22
committed
feat:adds Meiko's lesson 11
1 parent 396507b commit 7fa9655

File tree

1 file changed

+20
-2
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+20
-2
lines changed
Lines changed: 20 additions & 2 deletions
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 {
@@ -9,14 +10,31 @@ public class Lesson11 {
910
* https://leetcode.com/problems/concatenation-of-array
1011
*/
1112
public int[] getConcatenation(int[] nums) {
12-
return null;
13+
14+
int answer[] = new int[2 * nums.length];
15+
for (int i = 0; i < nums.length; i++) {
16+
answer[i] = nums[i];
17+
answer[i + nums.length] = nums[i];
18+
}
19+
20+
return answer;
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;
28+
29+
List<Integer> result = new ArrayList<>();
30+
31+
for (int i = 0; i < words.length; i++) {
32+
33+
if (words[i].indexOf(x) != -1) {
34+
result.add(i);
35+
}
36+
}
37+
38+
return result;
2139
}
2240
}

0 commit comments

Comments
 (0)