Skip to content

Commit d9e8173

Browse files
author
AmiyahJo
committed
feat: adds ts solution to LeetCode 2942
1 parent a0ff92d commit d9e8173

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.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,13 @@ function getConcatenation(nums: number[]): number[] {
2121
*/
2222

2323
function findWordsContaining(words: string[], x: string): number[] {
24-
24+
let indices: number[] = [];
25+
26+
for (let i = 0; i < words.length; i++){
27+
if(words[i].indexOf(x) >= 0){
28+
indices.push(i);
29+
}
30+
}
31+
32+
return indices;
2533
};

0 commit comments

Comments
 (0)