File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 33 * https://leetcode.com/problems/concatenation-of-array
44 */
55export function getConcatenation ( nums : number [ ] ) : number [ ] {
6- return [ ] ;
6+ const answer : number [ ] = new Array ( 2 * nums . length ) ;
7+ for ( let i = 0 ; i < nums . length ; i ++ ) {
8+ answer [ i ] = nums [ i ] ;
9+ answer [ i + nums . length ] = nums [ i ] ;
10+ }
11+ return answer ;
712}
813
14+
915/**
1016 * Provide the solution to LeetCode 2942 here:
1117 * https://leetcode.com/problems/find-words-containing-character/
1218 */
1319export 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 ] . indexOf ( x ) !== - 1 ) {
24+ result . push ( i ) ;
25+ }
26+ }
27+
28+ return result ;
1529}
30+
You can’t perform that action at this time.
0 commit comments