Skip to content

Commit d4809e7

Browse files
author
AmiyahJo
committed
fix: removed .ts file from java
feat: adds both leetcode solutions to original lesson11.ts file
1 parent d9e8173 commit d4809e7

File tree

2 files changed

+18
-35
lines changed

2 files changed

+18
-35
lines changed

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

Lines changed: 0 additions & 33 deletions
This file was deleted.

lesson_11/arrays_ts/src/lesson11.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,29 @@
33
* https://leetcode.com/problems/concatenation-of-array
44
*/
55
export function getConcatenation(nums: number[]): number[] {
6-
return [];
6+
let n: number = nums.length;
7+
let ans: number[] = new Array(2*n);
8+
9+
for(let i = 0; i < n; i++){
10+
ans[i] = nums[i];
11+
ans[i + n] = nums[i];
12+
}
13+
14+
return ans;
715
}
816

917
/**
1018
* Provide the solution to LeetCode 2942 here:
1119
* https://leetcode.com/problems/find-words-containing-character/
1220
*/
1321
export function findWordsContaining(words: string[], x: string): number[] {
14-
return [];
22+
let indices: number[] = [];
23+
24+
for (let i = 0; i < words.length; i++){
25+
if(words[i].indexOf(x) >= 0){
26+
indices.push(i);
27+
}
28+
}
29+
30+
return indices;
1531
}

0 commit comments

Comments
 (0)