Skip to content

Commit 15e1f13

Browse files
author
AmiyahJo
committed
feat: adds leetcode 2942 answer
provided I've already submitted on leetcode, I brought it over to vscode now
1 parent 6e709a2 commit 15e1f13

File tree

1 file changed

+9
-1
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
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 {
@@ -26,6 +27,13 @@ public int[] getConcatenation(int[] nums) {
2627
* https://leetcode.com/problems/find-words-containing-character/
2728
*/
2829
public List<Integer> findWordsContaining(String[] words, char x) {
29-
return null;
30+
List<Integer> indices = new ArrayList<>();
31+
32+
for (int i = 0; i < words.length; i++){
33+
if(words[i].indexOf(x) >= 0){
34+
indices.add(i);
35+
}
36+
}
37+
return indices;
3038
}
3139
}

0 commit comments

Comments
 (0)