Skip to content

Commit 6be73e6

Browse files
committed
feat: modifies lesson11.java to implement code for given functino name -Joseph Caballero
1 parent 3e8f77b commit 6be73e6

File tree

1 file changed

+17
-4
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+17
-4
lines changed
Lines changed: 17 additions & 4 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,26 @@ public class Lesson11 {
910
* https://leetcode.com/problems/concatenation-of-array
1011
*/
1112
public int[] getConcatenation(int[] nums) {
12-
return null;
13-
}
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+
}
1418

1519
/**
1620
* Provide the solution to LeetCode 2942 here:
1721
* https://leetcode.com/problems/find-words-containing-character/
1822
*/
1923
public List<Integer> findWordsContaining(String[] words, char x) {
20-
return null;
21-
}
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+
}
33+
}
34+
return num; }
2235
}

0 commit comments

Comments
 (0)