Skip to content

Commit 7efa6a8

Browse files
committed
Feat: Fixed commits, gradle and modified java lesson 11 by Hummad Tanweer
1 parent 439780a commit 7efa6a8

File tree

1 file changed

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

1 file changed

+18
-2
lines changed
Lines changed: 18 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,29 @@ public class Lesson11 {
910
* https://leetcode.com/problems/concatenation-of-array
1011
*/
1112
public int[] getConcatenation(int[] nums) {
12-
return null;
13+
// int len = nums.size();
14+
// return null;
15+
int n = nums.length;
16+
int ans[] = new int[2 * n];
17+
for (int i = 0; i < n; i++) {
18+
ans[i] = nums[i];
19+
ans[i + n] = nums[i];
20+
}
21+
return ans;
1322
}
1423

1524
/**
1625
* Provide the solution to LeetCode 2942 here:
1726
* https://leetcode.com/problems/find-words-containing-character/
1827
*/
1928
public List<Integer> findWordsContaining(String[] words, char x) {
20-
return null;
29+
30+
List result = new ArrayList();
31+
for (int i = 0; i < words.length; i++) {
32+
if (words[i].indexOf(x) != -1) {
33+
result.add(i);
34+
}
35+
}
36+
return result;
2137
}
2238
}

0 commit comments

Comments
 (0)