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 248938a9..26da2fb0 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,15 +1,21 @@ package com.codedifferently.lesson11; +import java.util.ArrayList; import java.util.List; public class Lesson11 { - /** * Provide the solution to LeetCode 1929 here: * https://leetcode.com/problems/concatenation-of-array */ public int[] getConcatenation(int[] nums) { - return null; + int n = nums.length; + int[] ans = new int[2 * n]; + for (int i = 0; i < n; i++) { + ans[i] = nums[i]; + ans[i + n] = nums[i]; + } + return ans; } /** @@ -17,6 +23,12 @@ public int[] getConcatenation(int[] nums) { * https://leetcode.com/problems/find-words-containing-character/ */ public List findWordsContaining(String[] words, char x) { - return null; + var results = new ArrayList(); + for (int i = 0; i < words.length; i++) { + if (words[i].indexOf(x) > -1) { + results.add(i); + } + } + return results; } -} +} \ No newline at end of file