diff --git a/lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java b/lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java index 248938a96..206cdc60c 100644 --- a/lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java +++ b/lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java @@ -1,5 +1,6 @@ package com.codedifferently.lesson11; +import java.util.ArrayList; import java.util.List; public class Lesson11 { @@ -10,13 +11,42 @@ public class Lesson11 { */ public int[] getConcatenation(int[] nums) { return null; + } + class Solution { + public int[] getConcatenation(int[] nums) { + int answer[] = new int[2 * nums.length]; + for(int i = 0; i < nums.length; i ++) { + answer[i]= nums[i]; + } + int index = nums.length; + for(int i = 0; i < nums.length; i ++) { + answer[index] = nums[i]; + index++; + } + return answer; + } } + + /** * Provide the solution to LeetCode 2942 here: * https://leetcode.com/problems/find-words-containing-character/ */ public List findWordsContaining(String[] words, char x) { + return null; } -} +} + + class Solution { + public List findWordsContaining(String[] words, char x) { + List resultWords = new ArrayList<>(); + for (int i = 0; i < words.length; i++) { + if (words[i].indexOf(x) != -1) { + resultWords.add(i); + } + } + return resultWords; + } +} \ No newline at end of file