diff --git a/lesson_11/arrays_ts/src/lesson11.ts b/lesson_11/arrays_ts/src/lesson11.ts index 54af1ba03..9545d9e48 100644 --- a/lesson_11/arrays_ts/src/lesson11.ts +++ b/lesson_11/arrays_ts/src/lesson11.ts @@ -1,15 +1,23 @@ -/** - * Provide the solution to LeetCode 1929 here: - * https://leetcode.com/problems/concatenation-of-array - */ export function getConcatenation(nums: number[]): number[] { - return []; + const n: number = nums.length; + const ans: number[] = new Array(2*n); + + for(let i = 0; i < n; i++){ + ans[i] = nums[i]; + ans[i + n] = nums[i]; + } + + return ans; } -/** - * Provide the solution to LeetCode 2942 here: - * https://leetcode.com/problems/find-words-containing-character/ - */ export function findWordsContaining(words: string[], x: string): number[] { - return []; + const indices: number[] = []; + + for (let i = 0; i < words.length; i++){ + if(words[i].indexOf(x) >= 0){ + indices.push(i); + } +} + +return indices; }