File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 3
3
* https://leetcode.com/problems/concatenation-of-array
4
4
*/
5
5
export function getConcatenation ( nums : number [ ] ) : number [ ] {
6
- return [ ] ;
7
- }
6
+ const answer : number [ ] = new Array ( nums . length * 2 ) ;
7
+
8
+ for ( let i = 0 ; i < nums . length ; i ++ ) {
9
+ answer [ i ] = nums [ i ] ;
10
+ answer [ i + nums . length ] = nums [ i ] ;
11
+ }
8
12
13
+ return answer ;
14
+ }
9
15
/**
10
16
* Provide the solution to LeetCode 2942 here:
11
17
* https://leetcode.com/problems/find-words-containing-character/
12
18
*/
13
19
export function findWordsContaining ( words : string [ ] , x : string ) : number [ ] {
14
- return [ ] ;
20
+ const result : number [ ] = [ ] ;
21
+
22
+ for ( let i = 0 ; i < words . length ; i ++ ) {
23
+ if ( words [ i ] . includes ( x ) ) {
24
+ result . push ( i ) ;
25
+ }
26
+ }
27
+
28
+ return result ;
15
29
}
You can’t perform that action at this time.
0 commit comments