File tree Expand file tree Collapse file tree 2 files changed +18
-35
lines changed
arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11 Expand file tree Collapse file tree 2 files changed +18
-35
lines changed Load Diff This file was deleted.
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 [ ] ;
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 ;
7
15
}
8
16
9
17
/**
10
18
* Provide the solution to LeetCode 2942 here:
11
19
* https://leetcode.com/problems/find-words-containing-character/
12
20
*/
13
21
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 ;
15
31
}
You can’t perform that action at this time.
0 commit comments