Skip to content

Commit 1cfb654

Browse files
committed
feat: LeetCode 1929 only - by Dwight Blue
1 parent 8ee965f commit 1cfb654

File tree

1 file changed

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

1 file changed

+21
-4
lines changed

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,31 @@ public class Lesson11 {
99
* https://leetcode.com/problems/concatenation-of-array
1010
*/
1111
public int[] getConcatenation(int[] nums) {
12-
return null;
13-
}
12+
int n = nums.length;
13+
int[] ans = new int[n*2];
14+
15+
for (int i=0; i<n; i++) {
16+
ans[i]=nums[i];
17+
ans[i+n]=nums[i];
18+
} return ans;
19+
}
20+
1421

1522
/**
1623
* Provide the solution to LeetCode 2942 here:
1724
* https://leetcode.com/problems/find-words-containing-character/
1825
*/
1926
public List<Integer> findWordsContaining(String[] words, char x) {
20-
return null;
21-
}
27+
int originalArray = words.length;
28+
// int newValue = (originalArray + 1);
29+
30+
int[] newArray = new int[originalArray.length + 1];
31+
32+
for (int i=0; i<originalArray; i++) {
33+
if (boolean CC=originalArray[i].contains(Character.toString(x)));
34+
System.arraycopy(originalArray,i,newArray,i,originalArray.length);
35+
36+
}
37+
return newArray;
38+
2239
}

0 commit comments

Comments
 (0)