From 7efa6a89401eb7e0dc72b003497b0923a22d56f5 Mon Sep 17 00:00:00 2001 From: htanweer244 Date: Mon, 21 Oct 2024 21:27:43 +0000 Subject: [PATCH 1/3] Feat: Fixed commits, gradle and modified java lesson 11 by Hummad Tanweer --- .../codedifferently/lesson11/Lesson11.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) 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..0bf47069 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 { @@ -9,7 +10,15 @@ public class Lesson11 { * https://leetcode.com/problems/concatenation-of-array */ public int[] getConcatenation(int[] nums) { - return null; + // int len = nums.size(); + // 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 +26,13 @@ public int[] getConcatenation(int[] nums) { * https://leetcode.com/problems/find-words-containing-character/ */ public List findWordsContaining(String[] words, char x) { - return null; + + List result = new ArrayList(); + for (int i = 0; i < words.length; i++) { + if (words[i].indexOf(x) != -1) { + result.add(i); + } + } + return result; } } From 985a70d58fd49c4351236b382444956ac5164216 Mon Sep 17 00:00:00 2001 From: htanweer244 Date: Mon, 21 Oct 2024 21:47:40 +0000 Subject: [PATCH 2/3] modfied --- .../src/main/java/com/codedifferently/lesson11/Lesson11.java | 1 + 1 file changed, 1 insertion(+) 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 0bf47069..db54ecf6 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 @@ -25,6 +25,7 @@ public int[] getConcatenation(int[] nums) { * Provide the solution to LeetCode 2942 here: * https://leetcode.com/problems/find-words-containing-character/ */ + // public List findWordsContaining(String[] words, char x) { List result = new ArrayList(); From 6a502e021eac6a5a2d1f7046cde7a51069f39220 Mon Sep 17 00:00:00 2001 From: htanweer244 Date: Mon, 21 Oct 2024 21:47:55 +0000 Subject: [PATCH 3/3] modified --- .../src/main/java/com/codedifferently/lesson11/Lesson11.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 db54ecf6..c33b6bd6 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 @@ -25,7 +25,7 @@ public int[] getConcatenation(int[] nums) { * Provide the solution to LeetCode 2942 here: * https://leetcode.com/problems/find-words-containing-character/ */ - // + // A public List findWordsContaining(String[] words, char x) { List result = new ArrayList();