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..0b878ab0f 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,20 @@ 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[] answer = new int[2 * nums.length]; + for (int i = 0; i < nums.length; i++) { + answer[i] = nums[i]; + answer[i + nums.length] = nums[i]; + } + return answer; } /** @@ -17,6 +22,14 @@ public int[] getConcatenation(int[] nums) { * https://leetcode.com/problems/find-words-containing-character/ */ public List findWordsContaining(String[] words, char x) { - return null; + List answer = new ArrayList<>(); + for (int i = 0; i < words.length; i++) { + if (words[i].contains(Character.toString(x))) { + answer.add(i); + } + } + return answer; } } +// I got help from Joesphs to talk things out and explain what this code is doing and how to go +// about applying code and what does it mean