diff --git a/lesson_11/arrays_java/arrays_app/src/lib/src/main/kotlin/org/example/Library.kt b/lesson_11/arrays_java/arrays_app/src/lib/src/main/kotlin/org/example/Library.kt new file mode 100644 index 000000000..9fd8a7f56 --- /dev/null +++ b/lesson_11/arrays_java/arrays_app/src/lib/src/main/kotlin/org/example/Library.kt @@ -0,0 +1,10 @@ +/* + * This source file was generated by the Gradle 'init' task + */ +package org.example + +class Library { + fun someLibraryMethod(): Boolean { + return true + } +} 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..1d9c77890 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 { @@ -12,11 +13,39 @@ 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; + } +}