Skip to content

Commit c31b5c1

Browse files
committed
Feat: adds leetcode problem solutions
1 parent 8ee965f commit c31b5c1

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
@@ -2,21 +2,38 @@
22

33
import java.util.List;
44

5+
56
public class Lesson11 {
67

78
/**
89
* Provide the solution to LeetCode 1929 here:
910
* https://leetcode.com/problems/concatenation-of-array
1011
*/
1112
public int[] getConcatenation(int[] nums) {
12-
return null;
13+
int n = nums.length;
14+
int ans[] = new int [2*n];
15+
for (int i = 0; i < nums.length; i++){
16+
ans[i] = nums[i]
17+
ans[i + n] = nums[i]
18+
}
19+
return ans;
1320
}
14-
21+
// Had help to understand better solutions from Joseph, Kimberlee, Nile, and Angelica, we were on Jitsi//
22+
1523
/**
1624
* Provide the solution to LeetCode 2942 here:
1725
* https://leetcode.com/problems/find-words-containing-character/
1826
*/
27+
public class Solution{
1928
public List<Integer> findWordsContaining(String[] words, char x) {
20-
return null;
21-
}
29+
List<Integer> indices = new ArrayList<>();
30+
for(int i = 0; i < words.length; i++){
31+
if (words[i].contains(String.valueOf(x))){
32+
indices.add(i);
33+
}
34+
}
35+
return indices;
36+
}
2237
}
38+
}
39+

0 commit comments

Comments
 (0)