Skip to content

Commit a78357e

Browse files
committed
feat: adds lesson_11-Kimberlee's leetcode problems
1 parent 8ee965f commit a78357e

File tree

1 file changed

+19
-3
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+19
-3
lines changed

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,30 @@ 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 [(2*n)];
14+
for (int i = 0; i < n; i ++) {
15+
ans[i] = nums[i];
16+
ans[i + n] = nums[i];
17+
}
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;
27+
28+
List<Integer> output = new ArrayList<>();
29+
30+
for (int i = 0; i < words.length; i++) {
31+
32+
if (words[i].indexOf(x) != -1) {
33+
output.add(i);
34+
}
35+
}
36+
return output;
2137
}
2238
}

0 commit comments

Comments
 (0)