File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11 Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 11package com .codedifferently .lesson11 ;
22
3+ import java .util .ArrayList ;
34import java .util .List ;
45
56public class Lesson11 {
6-
77 /**
88 * Provide the solution to LeetCode 1929 here:
99 * https://leetcode.com/problems/concatenation-of-array
1010 */
1111 public int [] getConcatenation (int [] nums ) {
12- return null ;
12+ int [] answer = new int [2 * nums .length ];
13+ for (int i = 0 ; i < nums .length ; i ++) {
14+ answer [i ] = nums [i ];
15+ answer [i + nums .length ] = nums [i ];
16+ }
17+ return answer ;
1318 }
1419
1520 /**
1621 * Provide the solution to LeetCode 2942 here:
1722 * https://leetcode.com/problems/find-words-containing-character/
1823 */
1924 public List <Integer > findWordsContaining (String [] words , char x ) {
20- return null ;
25+ List <Integer > answer = new ArrayList <>();
26+ for (int i = 0 ; i < words .length ; i ++) {
27+ if (words [i ].contains (Character .toString (x ))) {
28+ answer .add (i );
29+ }
30+ }
31+ return answer ;
2132 }
2233}
34+ // I got help from Joesphs to talk things out and explain what this code is doing and how to go
35+ // about applying code and what does it mean
You can’t perform that action at this time.
0 commit comments