-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: solved leet code problems for Zion Buchanan lesson 11 hw
- Loading branch information
Showing
1 changed file
with
16 additions
and
4 deletions.
There are no files selected for viewing
20 changes: 16 additions & 4 deletions
20
lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
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; | ||
} | ||
|
||
/** | ||
* Provide the solution to LeetCode 2942 here: | ||
* https://leetcode.com/problems/find-words-containing-character/ | ||
*/ | ||
public List<Integer> findWordsContaining(String[] words, char x) { | ||
return null; | ||
var results = new ArrayList<Integer>(); | ||
for (int i = 0; i < words.length; i++) { | ||
if (words[i].indexOf(x) > -1) { | ||
results.add(i); | ||
} | ||
} | ||
return results; | ||
} | ||
} | ||
} |