We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55e57eb commit 548f5f9Copy full SHA for 548f5f9
lesson_11/arrays_ts/src/lesson11.ts
@@ -3,13 +3,25 @@
3
* https://leetcode.com/problems/concatenation-of-array
4
*/
5
export function getConcatenation(nums: number[]): number[] {
6
- return [];
+ const n = nums.length;
7
+ const ans = new Array(2 * n);
8
+ for (let i = 0; i < n; i++) {
9
+ ans[i] = nums[i];
10
+ ans[i + n] = nums[i];
11
+ }
12
+ return ans;
13
}
14
15
/**
16
* Provide the solution to LeetCode 2942 here:
17
* https://leetcode.com/problems/find-words-containing-character/
18
19
export function findWordsContaining(words: string[], x: string): number[] {
20
+ const indices: number[] = [];
21
+ for (let i = 0; i < words.length; i++) {
22
+ if (words[i].includes(x)) {
23
+ indices.push(i);
24
25
26
+ return indices;
27
0 commit comments